Get a list of all file names including subfolders and export to a text file

Get a list of all file names including subfolders and export to a text file

To get a list of all files, including files inside subfolders that are ordered by date modified from the folder you are currently in you can type the following into your Windows cmd line(press windows key and type cmd):

dir /o:gd /S

'/o' is the 'order' filter. 

'g' will group results by directory/files so all directory listings will be first and then files so it's easier to read.

'd' will order the files by date modifed.

'/S' will go through all subfolders.

 

You can export this list into a text file to make it easier to process by typing ' >test.txt' at the end of your command:

dir /o:gd /S >test.txt

 

In Powershell you can achieve something similar using:

dir -recurse | Sort-Object LastWriteTime

You can output just a few fields by using the Select option if you'd prefer a more basic output:

dir -recurse | Select LastWriteTime,FullName | Sort-Object LastWriteTime | out-file "test.txt"

 

It's worth pointing out that you can also save off to another file format, like MS Excel, by simply typing 'test.xls' in your command. This can be useful if you want to do any further filtering later on.

 

There's a great explanation of all the commands you can use over on: https://ss64.com/nt/dir.html

blog comments powered by Disqus

Get In Touch

Follow me online at TwitterFacebook or Flickr.

Latest Tweets