We help IT Professionals succeed at work.

How to get a Windows directory listing including full sub-folders in path, and the creation date

I'm trying to print a Windows directory listing including the full sub-folder paths and creation date along with the file name.

Something like this, when run from say folder C:\TEMP:
28/02/2015       C:\TEMP\Blogs\test1.doc  
22/02/2015       C:\TEMP\Blogs\test2.txt  
22/02/2015       C:\TEMP\Pics\test1.xls    
28/02/2014       C:\TEMP\Pics\Sept\test2.jpg

If I could add a date display to the command   'dir /b /s '   it would give me what I want, I've tried /T:C as a guess but this does nothing.

There are some downloadable programs that would do the trick, but i need the command line/s or code as can't install any software on the system.

PS this is my first question so I hope it's OK, thank you if you can help
Watch Question

Hi Sharonera, and welcome to Expert Exchange

You question his well describe.

You can probable start to look at this bellow link:
Printing Directory Listings from Windows File Manager

Another way, would be to install Print Directory 2011
Print Directory 2011

Official site:

This will help you to print:
Simple file list, the directory and full folder tree, the details list of the file attribute etc..

Is this what you are looking for?
Otherwise, you can always go with command prompt:

dir /s >filename.txt

Open in new window

It should give you something like this in a text file:

Directory of C:\Users\Wilder1626\AppData\Local\Adobe

2015-02-22  04:05 PM    <DIR>          .
2015-02-22  04:05 PM    <DIR>          ..
2015-02-22  04:05 PM    <DIR>          Acrobat
2015-02-22  04:05 PM    <DIR>          Color
               0 File(s)              0 bytes
Most Valuable Expert 2013

I may have missed something but would

Dir <name of folder> /s > C:\<location you want file saved>dir.txt

work for you?

It could generate a huge textfile though if you've lots of subfolders - you can limit how far down the tree this goes by adding a number after the '/s'
Sorry. I gave you an application also, even if you said that you were not able to install any. But look at all other options.


Hi ,   Thanks for your responses!     Jean-Marc, thanks I'd tried the link you suggested but nothing there gave it to me.  And yes,  applications are out unfortunately as I can't install anything.

MASQ,   thanks  but I do need the full path including the subfolders, filename and create date on the same line,  not subfolders on separate lines above.  Reason is I'm going to import it into a program that will point to the files

The command  '  Dir  /b  /s  > list.txt   ' gives me what I need but without the date (see output test below)  however I need the date as well.  

Dir  ????   how do I get this ?  
28/02/2015       C:\TEMP\Blogs\test1.doc  
22/02/2015       C:\TEMP\Blogs\test2.txt  
22/02/2015       C:\TEMP\Pics\test1.xls    
28/02/2014       C:\TEMP\Pics\Sept\test2.jpg

Much appreciate any ideas , thanks
Bill PrewTest your restores, not your backups...
Expert of the Year 2019
Top Expert 2016

Here's a simple VBS approach, outputs in CSV format, so just pipe to a file and open in Excel.

cscript //nologo yourname.vbs > list.csv

' Specify folder to list folder from
sFolder = "c:\temp"

' Write header line
Wscript.Echo "Path,DateCreated,DateLastModified,DateLastModified"

' Create file system object
Set oFSO = WScript.CreateObject("Scripting.FileSystemObject")

' Call recursive subroutine to list all files under this folder (and subfolders)
Set oFolder = oFSO.GetFolder(sFolder)

' Process all folders in this folders
For Each oSubFolder In oFolder.Subfolders
   Wscript.Echo Quote(oSubFolder.Path) & "," & _
                oSubFolder.DateCreated & "," & _
                oSubFolder.DateLastAccessed & "," & _

' Add surrounding double quotes to a string
Function Quote(s)
   Quote = Chr(34) & s & Chr(34)
End Function

Open in new window

Raheman M. AbdulMessaging and Directory Services

If exported to .csv the results wont get truncated
get-childitem c:\windows -recurse  | select @{Name="Date";Expression={$_.creationtime.tostring('yyyy-MM-dd') } }, Fullname | export-csv c:\temp\windowsfiles.csv -NoTypeInformation

Open in new window

Most Valuable Expert 2019
Most Valuable Expert 2018
Batch one-liner; directly for the cmd console:
(for /f "delims=" %a in ('dir /s /b "C:\Temp"') do @echo "%~ta","%a")>list.txt

Open in new window

For a batch script, double up on the "%":
(for /f "delims=" %%a in ('dir /s /b "C:\Temp"') do @echo "%%~ta","%%a")>list.txt

Open in new window

Was going to suggest batch but oBdA got there first... add an /a-d to the dir command to save it showing directories and their time stamps too, just files i.e.

(for /f "delims=" %%a in ('dir /s /b /a-d "C:\Temp"') do @echo "%%~ta","%%a")>list.txt

It will show you the date and time stamp in whatever way the current date & time is.

HI Sharonera

I'm may not be the biggest expert on this topic, but you may want o test this.

You need to run CMD as an Administrator like below and type:
run as administrator
Dir c:\ /s >Directory.txt

Open in new window


Then, search for your file: Directory.txt. You will see your result like below.


THANK YOU so much every one,  I'm thrilled to get this help.  

OBdA & Steve,  your command one-liners in batch file did exactly what I needed - thank you!!    I'll use the option to exclude the folder-only lines as an added-plus!  

Very much appreciated,  


Oh oh first time user here.   I expected to be able to allocate a Multiple Solution to Steve after accepting OBda's solution that was first.     But it's greyed out now -  sorry I'll know for next time!
Bill PrewTest your restores, not your backups...
Expert of the Year 2019
Top Expert 2016

I cancelled the accepted single answer, go ahead and close with multiple solutions as you desired.


Wasn't a problem anyway, but thanks if you do.

Have a look at set /? and for /? For some of the other options. Effectively you are making a dir output of all you want to see them processing it a line at a time with for and showing different bits of the filename, e.g. you can get size, date, filename, extension, path etc. too and easily add in commas etc to make a CSV file as he did.

Good luck with it and welcome to EE!