I have full permissions on the root drive and inherency is turned on so there should be no folder permission errors. I know it will take a long time but that is okay with me. If it is not empty, the depth is greater than %lv% - no echo. I am wanting to start at the top level, root folder and encompass everything that falls under it. If yes, the depth is less or equal %lv% and the string is shown. The inner for checks, if token "%lv%+2" (therefore set /a lv+=2) is empty. offįor /f "tokens=1,%lv% delims=\" %%b in ("!x!") do if "%%c"="" echo !x!Īn input of "0" means "in this folder only, no subfolders" "2" means "in this folder and its subfolders, max. Therefore you have to parse its output with a for loop that does the removal: offįor sending automatic mails, see our search function, which is well hidden at the top right corner of this site (please don't tell anyone or we will get much less duplicates )).ĮDIT for I don't suppose there's anyway I can limit how far down in subdirectories this works? Is there any way to only return a list when there is something in a particular one of the "Name directories"? So if everything but "D Name" is empty, it will only return \D Name\file1.extĭir has no code to remove a part of it's output. I'd like to be able to have a list that shows the parent directory to the files so that it would show up something like this in the filelist.txt: "A Name\File1.ext"ĮDIT: Using dir /b/s seems to list all subdirectories, files and gives the full path length. Here's a really pitiful illustration of the file structure. I'm going to try and get this script to attach the "filelist.txt" to an email and send it out automatically.ĮDIT: Forgot a much more important bonus problem. However, I'm not sure how to get a list of the files inside of the sub-directories.īONUS: This is an extra bit that I haven't actually researched yet but thought I'd throw it in there. It will generate a list of files in the directory or subdirectory in a new worksheet. I can get around the two alphabetical directories easily by just writing two lines for this. Open Excel, Click Filename List, dialog box,do the following operations. The files I want to get for the list are nestled in multiple user directories which are nestled inside two directories (A-L / M-Z). It is possible to customize filters to exclude/include files and. This works perfectly with one small hitch. The program is used to list files and subfolders inside a selected local file system path. I'd like to create a batch script that will create a list of all files in a directory.ĭir c:\users\documents\* /b > filelist.txt
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |