Sharonera
asked on
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.jp g
etc
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
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.jp
etc
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
Otherwise, you can always go with command prompt:
It should give you something like this in a text file:
Directory of C:\Users\Wilder1626\AppDat a\Local\Ad obe
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
dir /s >filename.txt
It should give you something like this in a text file:
Directory of C:\Users\Wilder1626\AppDat
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
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'
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.
ASKER
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.
C:\TEMP\Blogs\test1.doc
C:\TEMP\Blogs\test2.txt
C:\TEMP\Pics\test1.xls
C:\TEMP\Pics\Sept\test2.jp g
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.jp g
Much appreciate any ideas , thanks
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.
C:\TEMP\Blogs\test1.doc
C:\TEMP\Blogs\test2.txt
C:\TEMP\Pics\test1.xls
C:\TEMP\Pics\Sept\test2.jp
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.jp
Much appreciate any ideas , thanks
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
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 & "," & _
oSubFolder.DateLastModified
Next
' Add surrounding double quotes to a string
Function Quote(s)
Quote = Chr(34) & s & Chr(34)
End Function
~bp
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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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,
Sharonera
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,
Sharonera
ASKER
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!
I cancelled the accepted single answer, go ahead and close with multiple solutions as you desired.
~bp
~bp
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!
Steve
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!
Steve
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:
http://www.print-directory
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?