1
1
I have a batch file that gives me a directory listing of all files in current and subfolders. I would like to change this to list all files that are in subfolders but NOT the current folder. Currently I am using this command below which successfully works to list all the files in the current folder AND subfolders.
cd "c:\temp"
dir /s/b *.doc>c:\temp\mylist.txt
This produces results as follows:
c:\temp\test8.doc
c:\temp\test9 (2).doc
c:\temp\test9.doc
c:\temp\012015\blah_012340.doc
c:\temp\032016\blah_124756.doc
c:\temp\042016\blah_125230.doc
c:\temp\052016\blah_052647.doc
I would like my results to not show what is directly in c:\temp, so my desired results would be:
c:\temp\012015\blah_012340.doc
c:\temp\032016\blah_124756.doc
c:\temp\042016\blah_125230.doc
c:\temp\052016\blah_052647.doc
Why don't you use
tree /f
for better visual quality? – None – 2016-11-08T22:49:44.667I'm not an expert on PowerShell but I think you can do it easily on PowerShell using
-include
and-exclude
switches ofdir
(alias). – None – 2016-11-08T22:51:22.870I don't think tree wil work as I need the list dumped into a list, which I then use for my next function in the batch file. Powershell may work but I don't know powershell either. I guess I can try and find some examples that might work and go from there. – Jose – 2016-11-08T23:23:36.897