Regarding Windows batch files: is there a way to list all files (or all of a specific type) in a specific directory and its subdirectories, including paths relative to the current (or search) directory in the list?
For example, if I want all txt files in the current directory and subdirectories with their full paths, I can do
for /r . %%g in (*.txt) do echo %%g >> C:\temp\test.txt
or
dir *.txt /b /s >> C:\temp\test.txt
and i will get something like
C:\test\Doc1.txt C:\test\subdir\Doc2.txt C:\test\subdir\Doc3.txt
If i do
for /r . %%g in (*.txt) do echo %%~nxg >> C:\temp\test.txt
I will get something like
Doc1.txt Doc2.txt Doc3.txt
But I really want:
Doc1.txt subdir\Doc2.txt subdir\Doc3.txt
Is it possible?
If my post is too confusing: I basically want to " recursively list files in the Linux CLI with an outline relative to the current directory ", for Windows only.
windows cmd batch-file
Tim Meyer Dec 05 '11 at 12:40 2011-12-05 12:40
source share