subdirectory

Non-recursive way to get all files in a directory and its subdirectories in Java

只谈情不闲聊 提交于 2019-11-27 14:49:24
问题 I am trying to get a list of all files in a directory and its subdirectories. My current recursive approach is as follows: private void printFiles(File dir) { for (File child : dir.listFiles()) { if (child.isDirectory()) { printFiles(child); } else if (child.isFile()) { System.out.println(child.getPath()); } } } printFiles(new File("somedir/somedir2")); However, I was hoping there was a non-recursive way (an existing API call, maybe) of doing this. If not, is this the cleanest way of doing

Vbscript list all PDF files in folder and subfolders

夙愿已清 提交于 2019-11-27 14:41:48
Well here is my code but I just can not filter the listing using the objFile.Extension i am sure it is some thing silly Set objFSO = CreateObject("Scripting.FileSystemObject") objStartFolder = "C:\dev" Set objFolder = objFSO.GetFolder(objStartFolder) Wscript.Echo objFolder.Path Set colFiles = objFolder.Files For Each objFile in colFiles If objFile.Extension = "PDF" Then Wscript.Echo objFile.Name End If Next Wscript.Echo ShowSubfolders objFSO.GetFolder(objStartFolder) Sub ShowSubFolders(Folder) For Each Subfolder in Folder.SubFolders Wscript.Echo Subfolder.Path Set objFolder = objFSO.GetFolder

Sub folders in drawable resource folder? [duplicate]

こ雲淡風輕ζ 提交于 2019-11-27 14:26:31
This question already has an answer here: Can the Android drawable directory contain subdirectories? 20 answers How to access res/drawable/“folder” 5 answers I would like to create sub folders in drawable folder. I have a lot of file(such as png, xml) in drawable folder. I want to create sub folders in there to find the files easily. Can I create sub folders like that? Thanks. This is now (sort of) possible by using Android Studio and Gradle. Whilst subfolders are still not possible, it is possible to separate resources into different sets and have them merged by the build system . As an

How to create nonexistent subdirectories recursively using Bash?

亡梦爱人 提交于 2019-11-27 10:12:10
I am creating a quick backup script that will dump some databases into a nice/neat directory structure and I realized that I need to test to make sure that the directories exist before I create them. The code I have works, but it seems that there is a better way to do it. Any suggestions? [ -d "$BACKUP_DIR" ] || mkdir "$BACKUP_DIR" [ -d "$BACKUP_DIR/$client" ] || mkdir "$BACKUP_DIR/$client" [ -d "$BACKUP_DIR/$client/$year" ] || mkdir "$BACKUP_DIR/$client/$year" [ -d "$BACKUP_DIR/$client/$year/$month" ] || mkdir "$BACKUP_DIR/$client/$year/$month" [ -d "$BACKUP_DIR/$client/$year/$month/$day" ] |

List all files and directories in a directory + subdirectories

橙三吉。 提交于 2019-11-27 10:04:01
问题 I want to list every file and directory contained in a directory and subdirectories of that directory. If I chose C:\ as the directory, the program would get every the name of every file and folder on the hard drive that it had access to. A list might look like fd\1.txt fd\2.txt fd\a\ fd\b\ fd\a\1.txt fd\a\2.txt fd\a\a\ fd\a\b\ fd\b\1.txt fd\b\2.txt fd\b\a fd\b\b fd\a\a\1.txt fd\a\a\a\ fd\a\b\1.txt fd\a\b\a fd\b\a\1.txt fd\b\a\a\ fd\b\b\1.txt fd\b\b\a 回答1: string[] allfiles = Directory

SVN move single directory into other repository (with history)

我们两清 提交于 2019-11-27 09:59:25
问题 Related question: Moving repository trunk to another’s branch (with history) I know that one can dump a complete SVN repository with history and load it into a user-defined (sub)directory of the target repository using: // in source repo > svnadmin dump . > mydumpfilename // in destination repo (backslashes because I'm using Windows) > svnadmin load . < mydumpfilename --parent-dir some\sub\directory But this will import the full repository into the target repository's sub-directory. What I

PHP - Listing all directories and sub-directories recursively in drop down menu [duplicate]

强颜欢笑 提交于 2019-11-27 08:25:52
Possible Duplicate: PHP Get all subdirectories of a given directory I want a drop down menu to show all sub-directories in ./files/$userid/ not just the main folder. For example: /files/$userid/folder1/folder2/ My current code is: HTML: <select name="myDirs"> <option value="" selected="selected">Select a folder</option> PHP: if (chdir("./files/" . $userid)) { $dirs = glob('*', GLOB_ONLYDIR); foreach($dirs as $val){ echo '<option value="'.$val.'">'.$val."</option>\n"; } } else { echo 'Changing directory failed.'; } RecursiveDirectoryIterator should do the trick. Unfortunately, the documentation

.htaccess redirection to subfolder (masked)

自闭症网瘾萝莉.ら 提交于 2019-11-27 07:16:11
问题 I want to redirect "www.adomain.com" to "www.adomain.com/cms". The cms-part should be masked. I don't get it to work silently. So "cms" is always part of the url. I tried this solution: https://stackoverflow.com/a/4475173/1052107, but I always get an Internal Server Error. 回答1: RewriteEngine on RewriteBase / RewriteRule ^(.*)$ /folder/$1 And this should go in the .htaccess file at the root of the domain. This is pulled off a site I have doing this now, so it should work 来源: https:/

.htaccess RewriteRule not working in subdirectory

本秂侑毒 提交于 2019-11-27 06:03:14
问题 I'm programming the new version of my website and I'm trying to get .htaccess to rewrite properly. My new site is stored here: www.example.com/storage/new/ I need to rewrite these URLs: www.example.com/storage/new/welcome/ -> index.php?action=welcome www.example.com/storage/new/page/name/ -> index.php?action=page&url=name www.example.com/storage/new/post/name/ -> index.php?action=post&url=name This is my .htaccess file: RewriteEngine On RewriteRule ^/welcome/$ index.php?action=welcome [L]

Best way to iterate folders and subfolders

萝らか妹 提交于 2019-11-27 04:21:50
What's the best way to iterate folders and subfolders to get file size, total number of files, and total size of folder in each folder starting at a specified location? Lloyd Use Directory.GetFiles() . The bottom of that page includes an example that's fully recursive, I believe. Chris Dunaway If you're using .NET 4, you may wish to use the System.IO.DirectoryInfo.EnumerateDirectories and System.IO.DirectoryInfo.EnumerateFiles methods. If you use the Directory.GetFiles method as other posts have recommended, the method call will not return until it has retrieved ALL the entries. This could