I'm trying to output, to a text file, a list of files in a folder and its sub-folders in a one line per file format with
date, size and folder name.
I've fiddled around with various switches but I have not got there yet.
Any ideas anybody?
Thanks
File list using DIR
Moderator: DosItHelp
Re: File list using DIR
Run DIR in a FOR /F loop and use the modifiers of FOR variables to expand them to the data you need.
Regards
aGerman
Code: Select all
for /f "delims=" %%i in ('dir /a /b /s "c:\your\folder"') do echo "%%~nxi" %%~ti %%~zi "%%~dpi"
Regards
aGerman
Re: File list using DIR
+1 but use /a-d instead of /a in the dir command, to eliminate folders.
-
- Posts: 2
- Joined: 02 Nov 2013 07:41
Re: File list using DIR
Thanks for this.
Where do I insert the file name in which I would llke the listing saved?
Thanks
Where do I insert the file name in which I would llke the listing saved?
Thanks
Re: File list using DIR
highandwild wrote:Thanks for this.
Where do I insert the file name in which I would llke the listing saved?
Thanks
Redirect the output of aGerman's code to a text file.
You can read about redirecting output here.
http://www.robvanderwoude.com/redirection.php
-
- Posts: 10
- Joined: 21 Nov 2013 01:07
Re: File list using DIR
The only other thing I saw was "FindFileFirst", but I can't seem to get that to work at all.
So, my question is, how do I get the names of folders using "Dir()"?
So, my question is, how do I get the names of folders using "Dir()"?