I have a simple batch script that recursively looks at all files and folders within the directory and writes out the file inventory to a text file. It currently looks like this:
dir /b/s > files.txt
The /b
means don't give any extra info and /s
makes it recursive within sub-folders. The sample output is:
C:\Users\mark\Desktop\site\site\Web
C:\Users\mark\Desktop\site\site\Web\Themes
C:\Users\mark\Desktop\site\site\Web\Themes\Sitev2
C:\Users\mark\Desktop\site\site\Web\Themes\Sitev2\images
C:\Users\mark\Desktop\site\site\Web\Themes\Sitev2\style
C:\Users\mark\Desktop\site\site\Web\Themes\Sitev2\images\site
C:\Users\mark\Desktop\site\site\Web\Themes\Sitev2\images\site\beta.gif
C:\Users\mark\Desktop\site\site\Web\Themes\Sitev2\style\site.css
C:\Users\mark\Desktop\site\site\Web\Themes\Sitev2\style\ie7.css
I'd like two things:
- Only list out files in this listing rather than files and folders
- I'd like the paths to be relative from where the batch script was called
E.g. I have the script in the C:\Users\mark\Desktop\site\site\
folder so I don't want to see up to that point.
Is it possible to do those two things and if so, can anyone help with either?