Export all folders/subfolders/files to CSV with file details(modified,created,size,extension)

English support forum

Moderators: white, Hacker, petermad, Stefan2

Post Reply
bobargo1
Junior Member
Junior Member
Posts: 3
Joined: 2019-05-31, 10:31 UTC

Export all folders/subfolders/files to CSV with file details(modified,created,size,extension)

Post by *bobargo1 »

Hello,

I tried to find an answer here but failed, so decided to post this.
I have a multi folder tree and need to export all metadata to a file, including all item's details like last modified date,created date, size, extension.
Does anyone know if that's possible?

Thanks in advance,
BA
User avatar
Horst.Epp
Power Member
Power Member
Posts: 6450
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: Export all folders/subfolders/files to CSV with file details(modified,created,size,extension)

Post by *Horst.Epp »

That can be done in Everything.
Set the columns you want, display what you like and use File / Export
Windows 11 Home x64 Version 23H2 (OS Build 22631.3374)
TC 11.03 x64 / x86
Everything 1.5.0.1371a (x64), Everything Toolbar 1.3.2, Listary Pro 6.3.0.69
QAP 11.6.3.2 x64
User avatar
Stefan2
Power Member
Power Member
Posts: 4133
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Re: Export all folders/subfolders/files to CSV with file details(modified,created,size,extension)

Post by *Stefan2 »

Hi and welcome bobargo1,

one way is to

- FAQs: Create a user defined 'Custom Column' with all need details viewtopic.php?p=351792#p351792
- use Menu Commands > Branch View
- use internal command "cm_CopyFileDetailsToClip" (Copy all shown columns)
- use a text editor to change TAB to semicolon


another way is to use TCs argument to create a temporary file with a list of all selected files (see [Help] in a button-dialog and there %F and %L)
and pass that argument as parameter to an external script (mostly we use batch, VBS and AutoHotkey)




 
bobargo1
Junior Member
Junior Member
Posts: 3
Joined: 2019-05-31, 10:31 UTC

Re: Export all folders/subfolders/files to CSV with file details(modified,created,size,extension)

Post by *bobargo1 »

Thanks for your responses, but I'm looking something that I can schedule as a script.
I use ' tree /f /a > "_TREE-Output.txt" ' to export all into a file, but now it's not enough because it misses date of creation of files.
Any ideas if "tree" command has such attributes?

Thanks
User avatar
Horst.Epp
Power Member
Power Member
Posts: 6450
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: Export all folders/subfolders/files to CSV with file details(modified,created,size,extension)

Post by *Horst.Epp »

bobargo1 wrote: 2019-06-04, 16:41 UTC Thanks for your responses, but I'm looking something that I can schedule as a script.
I use ' tree /f /a > "_TREE-Output.txt" ' to export all into a file, but now it's not enough because it misses date of creation of files.
Any ideas if "tree" command has such attributes?

Thanks
The ES command line tool of Everything can do that and its no problem of course to use it in script.
Windows 11 Home x64 Version 23H2 (OS Build 22631.3374)
TC 11.03 x64 / x86
Everything 1.5.0.1371a (x64), Everything Toolbar 1.3.2, Listary Pro 6.3.0.69
QAP 11.6.3.2 x64
bobargo1
Junior Member
Junior Member
Posts: 3
Joined: 2019-05-31, 10:31 UTC

Re: Export all folders/subfolders/files to CSV with file details(modified,created,size,extension)

Post by *bobargo1 »

Horst.Epp wrote: 2019-06-04, 17:54 UTC
bobargo1 wrote: 2019-06-04, 16:41 UTC Thanks for your responses, but I'm looking something that I can schedule as a script.
I use ' tree /f /a > "_TREE-Output.txt" ' to export all into a file, but now it's not enough because it misses date of creation of files.
Any ideas if "tree" command has such attributes?

Thanks
The ES command line tool of Everything can do that and its no problem of course to use it in script.
Could you point out what are the attributes of "tree" command in order to include file creation date into an output txt file, please?
simply "tree /f /a > "_TREE-Output.txt" doesn't have additional columns.
Or am I doing something wrong?
User avatar
Stefan2
Power Member
Power Member
Posts: 4133
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Re: Export all folders/subfolders/files to CSV with file details(modified,created,size,extension)

Post by *Stefan2 »

bobargo1 wrote: 2019-06-05, 11:29 UTC...

Could you point out what are the attributes of "tree" command in order to include file creation date into an output txt file, please?
simply "tree /f /a > "_TREE-Output.txt" doesn't have additional columns.

There are no options for the 'DOS' TREE command to create such output.
Use a PowerShell, VBScript or AutoHotkey script for to get the wanted result.

You can do that too with TC as above mentioned (but not for "schedule as a script")
or by utilizing a external tool like above said "Everything" ( I don't know if that tool works as you would like it to do, so read there homepage or try it out yourself ) .





 
User avatar
tuska
Power Member
Power Member
Posts: 3740
Joined: 2007-05-21, 12:17 UTC

Re: Export all folders/subfolders/files to CSV with file details(modified,created,size,extension)

Post by *tuska »

Horst.Epp wrote: 2019-06-04, 17:54 UTC The ES command line tool of Everything can do that ...
Examples:

Code: Select all

es.exe C:\Tools\Everything\ -date-modified -date-created -size -extension -export-csv results.csv
es.exe "C:\Tools\Everything\Everything Command-line Interface\" -date-modified -date-created -size -extension -export-csv results.csv
es.exe *.avi -date-modified -date-created -size -extension -export-csv results.csv
Hint:
If the files "es.exe" and "cli.c" are located in the path C:\Tools\Everything\ and this window is active in TC,
then you can enter the following into the command line of TC and press <enter> - e.g. (another example...)

Code: Select all

es.exe D:\Data\WINWORD\ -date-modified -date-created -size -extension -export-csv results.csv
The file "results.csv" is then stored in the path C:\Tools\Everything\.

Help - Support
http://www.voidtools.com/support/everything/command_line_interface/

Command Line Tool for Everything 1.4.1 - Introduction and examples
https://www.voidtools.com/forum/viewtopic.php?f=2&t=5762


Windows 10 Pro (x64) Version 1903 (OS Build 18362.145)
Intel(R) Core(TM) i7-4770 CPU @ 3.4OGHz, 16 GB RAM
TC 9.22a x64/x86 | Everything - Version 1.4.1.943 (x64)
☑ 'Everything' | How to use TC <=> Everything
User avatar
Stefan2
Power Member
Power Member
Posts: 4133
Joined: 2007-09-13, 22:20 UTC
Location: Europa

PowerShell: Export all folders/subfolders/files to CSV with file details(modified,created,size,extension)

Post by *Stefan2 »

tuska wrote: 2019-06-05, 15:21 UTC es.exe C:\Tools\Everything\ -date-modified -date-created -size -extension -export-csv results.csv

So Everything in companion with its ES-Command Line Tool can do more than just perform a search.
Interesting and easier to handle than PowerShell.
Thanks.

Now only the TREE-format output is missing.



(((i am tested a PoSh-Script today, but was not pleased enough to share it)))


EDIT

Here is it. Based on a script I found by Christian.
I adjusted it a bit. Far from perfect, especially the order of files and folder listed, ...but it seems to work more or less

Code: Select all

#  https://blog.christianjaeckle.de/verzeichnisbaum-mit-powershell-darstellen/
#  
#  Verzeichnisbaum mit Powershell darstellen
#  Veröffentlicht am 21. Dezember 2012 von Christian	
#  
#  Seit DOS und jetzt in der Eingabeaufforderung gibt es schon seit Jahren
#  den Befehl „Tree“ der einen Verzeichnisbaum der Verzeichnisse (und
#  Dateien) zeichnet.
#  
#  Powershell kann das auch, wenn auch etwas umständlicher, denn hier gibt
#  es keinen Befehl dafür. Aber durch das einzelne durchlaufen der
#  Verzeichnisebenen und ausgeben kann dies ebenso erreicht werden.
#  
#  Hier mal ein Skript, welches die Vorgehensweise zeigt. Der Vorteil von
#  einem eigenen Skript ist hier, dass man so das Ausgabeformat genau an
#  die eigenen Wünsche anpassen kann.
#  



# 2019-June-06, modified version.

#USAGE:
#- save script as *.ps1 file (Show-DirectoryTree.ps1)
#- open PowerShell console
#- dot source the  *.ps1 file (. .\Show-DirectoryTree.ps1)
#- execute the script with a folder as parameter (Show-DirectoryTree C:\Temp)


Function Show-DirectoryTree {
	# Function which shows a directory tree of a given folder.
	Param ( [string]$strStartDir )
	$objChildren = get-childitem $strStartDir        #| sort-object Name
	ForEach ($objChild in $objChildren) {
		$Spacer = ("`t" * $intI)
		If ($objChild.PSIsContainer) {
			#// Output for folders:
			"{0} {1}\" -f $Spacer, $objChild
			# Recurse through sub-directory
			$intI ++
			Show-DirectoryTree $objChild.PSPath
			$intI --
		}else{
			#// Output for files:
			#// Files in root or in sub folder? => different output format:
			If($intI -lt 1){
				"{0};{1};{2}"               -f $objChild, $objChild.LastWriteTime, $objChild.Length
			}else{
				 "{0}   |- {1};{2};{3}"     -f $Spacer, $objChild, $objChild.LastWriteTime, $objChild.Length
				#"{0} {1};{2};{3};{4};{5}"  -f $Spacer, $objChild, $objChild.LastWriteTime ,$objChild.CreationTime, $objChild.Length, $objChild.Extension
			}
		}
	}
}
#// STORE (see "gci | gm" for complete list):
# $objChild.Length
# $objChild.Name 
# $objChild.BaseName 
# $objChild.Extension
# $objChild.CreationTime
# $objChild.LastAccessTime
# $objChild.LastWriteTime


#// Start with Examples:
#Show-DirectoryTree $Env:Temp
#Show-DirectoryTree "C:\Windows\Temp\"


Example Result:

Code: Select all

 d\
	   |- TASTEN.TXT;14.12.2016 09:00:10;10580
	   |- TOTALCMD.CHM;14.12.2016 09:00:10;513655
 e\
	   |- KEYBOARD.TXT;14.12.2016 09:00:10;11021
	   |- TOTALCMD.CHM;14.12.2016 09:00:10;475105
 LANGUAGE\
	   |- WCMD_CHN.INC;14.12.2016 09:00:10;13011
	   |- WCMD_CHN.LNG;14.12.2016 09:00:10;59422
	   |- WCMD_CHN.MNU;14.12.2016 09:00:10;4753
		....
	   |- WCMD_SWE.LNG;14.12.2016 09:00:10;74811
	   |- WCMD_SWE.MNU;14.12.2016 09:00:10;5654
 plugins\
	 wcx\
		 TreeCopyPlus\
			   |- ReadmeEng.txt;26.09.2011 19:53:56;3198
			   |- ReadmeRus.txt;26.09.2011 19:57:26;3277
			   |- TreeCopyPlus.wcx;26.09.2011 17:38:00;98304
			   |- TreeCopyPlus.wcx64;26.09.2011 17:37:48;110080
CABRK.DLL;14.12.2016 09:00:10;43008
CGLPT64.SYS;14.12.2016 09:00:10;30000
CGLPT9X.VXD;14.12.2016 09:00:10;7259
CGLPTNT.SYS;14.12.2016 09:00:10;20768
DEFAULT.BAR;10.04.2017 16:37:43;1540
default.br2;10.04.2017 16:37:43;23624
descript.ion;14.12.2016 09:00:10;2668
FRERES32.DLL;14.12.2016 09:00:10;7680
HISTORY.TXT;14.12.2016 09:00:10;680696
NO.BAR;14.12.2016 00:00:00;26
NOCLOSE.EXE;14.12.2016 09:00:10;50256
NOCLOSE64.EXE;14.12.2016 09:00:10;59984
SFXHEAD.SFX;14.12.2016 09:00:10;40960
SHARE_NT.EXE;14.12.2016 09:00:10;2106
SIZE!.TXT;14.12.2016 09:00:10;602
TC7Z.DLL;14.12.2016 09:00:10;172032
TC7Z64.DLL;14.12.2016 09:00:10;192000
TC7ZIPIF.DLL;14.12.2016 09:00:10;83024
TCLZMA64.DLL;14.12.2016 09:00:10;107520
TCMADM64.EXE;14.12.2016 09:00:10;108112
TCMADMIN.EXE;14.12.2016 09:00:10;83024
TCMDLZMA.DLL;14.12.2016 09:00:10;86016
TCMDX32.EXE;14.12.2016 09:00:10;91216
TCMDX64.EXE;14.12.2016 09:00:10;126544
TCUNIN64.EXE;14.12.2016 09:00:10;97896
TCUNIN64.WUL;14.12.2016 09:00:10;2130
TCUNINST.EXE;14.12.2016 09:00:10;47696
TCUNINST.WUL;14.12.2016 09:00:10;2130
TCUNZL64.DLL;14.12.2016 09:00:10;143952
TCUNZLIB.DLL;14.12.2016 09:00:10;123984
TcUsbRun.exe;14.12.2016 09:00:10;58448
TOTALCMD.CHM;14.12.2016 09:00:10;513655
TOTALCMD.EXE;14.12.2016 09:00:10;4456568
TOTALCMD.EXE.MANIFEST;14.12.2016 09:00:10;1530
TOTALCMD.INC;14.12.2016 09:00:10;25936
TOTALCMD64.EXE;14.12.2016 09:00:10;8694408
TOTALCMD64.EXE.MANIFEST;14.12.2016 09:00:10;1536
UNACEV2.DLL;14.12.2016 09:00:10;77312
UNRAR.DLL;14.12.2016 09:00:10;269200
UNRAR64.DLL;14.12.2016 09:00:10;321936
UNRAR9X.DLL;14.12.2016 09:00:10;168448
usercmd.ini;21.02.2019 10:28:02;87
VERTICAL.BAR;14.12.2016 00:00:00;417
vertical.br2;24.03.2017 09:41:46;7090
WC32TO16.EXE;14.12.2016 09:00:10;3328
WCMICON2.DLL;14.12.2016 09:00:10;1553920
WCMICONS.DLL;14.12.2016 09:00:10;639360
WCMICONS.INC;14.12.2016 09:00:10;1804
WCMZIP32.DLL;14.12.2016 09:00:10;132176
WCMZIP64.DLL;14.12.2016 09:00:10;158288
WCUNINST.WUL;14.12.2016 09:00:10;106
wcx_ftp.ini;22.03.2017 10:22:53;0
WINCMD.INI;01.04.2019 10:25:05;4295

Hmm, oh well :roll:


 
User avatar
tuska
Power Member
Power Member
Posts: 3740
Joined: 2007-05-21, 12:17 UTC

Re: Export all folders/subfolders/files to CSV with file details(modified,created,size,extension)

Post by *tuska »

tuska wrote: 2019-06-05, 15:21 UTC Hint:
If the files "es.exe" and "cli.c" are located in the path C:\Tools\Everything\ and this window is active in TC,
then you can enter the following into the command line of TC and press <enter> - e.g. (another example...)

Code: Select all

es.exe D:\Data\WINWORD\ -date-modified -date-created -size -extension -export-csv results.csv
The file "results.csv" is then stored in the path C:\Tools\Everything\.
Which DOS command would I have to enter beforehand,
- if es.exe is located in C:\Tools\Everything\ AND
- es.exe D:\Data\WINWORD\ ... -export-csv results.csv
- is to be executed in D:\Data\WINWORD\ (active TC window)?
User avatar
Stefan2
Power Member
Power Member
Posts: 4133
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Re: Export all folders/subfolders/files to CSV with file details(modified,created,size,extension)

Post by *Stefan2 »

tuska wrote: 2019-06-05, 17:47 UTC Which DOS command would I have to enter beforehand,
?
I don't understood what you want and why.

That?
C:\Tools\Everything\es.exe D:\Data\WINWORD\ ... -export-csv results.csv
or
C:\Tools\Everything\es.exe "%P" ... -export-csv results.csv

But me guess you know that already :D



 
User avatar
tuska
Power Member
Power Member
Posts: 3740
Joined: 2007-05-21, 12:17 UTC

Re: Export all folders/subfolders/files to CSV with file details(modified,created,size,extension)

Post by *tuska »

2Stefan2
Thank you for your hints on two solutions! (TC commandline and button)

I wanted to enter this in the TC command line:
es.exe D:\Data\WINWORD\ -date-modified -date-created -size -extension -export-csv results.csv

Active window in TC and path: D:\Data\WINWORD.

I got the following error message:
"es.exe" could not be found.
Make sure you entered the name correctly and repeat the process."


I read the DOS SET command at some point and thought I should use it.

I am already very satisfied with the existing solutions - which you have shown me.

Button:

Code: Select all

TOTALCMD#BAR#DATA
C:\Tools\Everything\es.exe
"%P" -date-modified -date-created -size -extension -export-csv results.csv
%COMMANDER_PATH%\TOTALCMD.EXE,2
Everything Command-line Interface  ||  es.exe, cli.c|https://ghisler.ch/board/viewtopic.php?f=3&t=52809|http://www.voidtools.com/support/everything/command_line_interface/|https://www.voidtools.com/forum/viewtopic.php?f=2&t=5762


-1
TC commandline:

Code: Select all

C:\Tools\Everything\es.exe D:\Data\WINWORD\ -date-modified -date-created -size -extension -export-csv results.csv
EDIT:
Added: TC commandline
Last edited by tuska on 2019-06-06, 12:26 UTC, edited 3 times in total.
User avatar
Stefan2
Power Member
Power Member
Posts: 4133
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Re: Export all folders/subfolders/files to CSV with file details(modified,created,size,extension)

Post by *Stefan2 »

tuska wrote: 2019-06-05, 18:25 UTC I wanted to enter this in the TC command line:
es.exe D:\Data\WINWORD\ -date-modified -date-created -size -extension -export-csv results.csv

I got the following error message:
"es.exe" could not be found.
Make sure you entered the name correctly and repeat the process."
You have to enter the full path to the folder with the es.exe: C:\Tools\Everything\es.exe D:\Data\WINWORD\ ...

Alternative add the folder with the es.exe to your systems PATH variable (not really recommended to do that with every tool)

Or add es.exe to the registry as well know executable as like Notepad and Paint for example. (i don't know if that work for tools used with arguments too?)
Me think that was HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\

Or SUBST the folder with the es.exe to a drive letter and use next: T:\es.exe D:\Data\WINWORD\ ... .....

Or -if possible with that tool (if it doesn't need other files)- put that exe to your TC folder and use: %Commander_Path%\Tools\ES\es.exe D:\Data\WINWORD\ ...




>> DOS SET command

Interesting idea!

Me use SET in batch files only...

But this also works for example with %ProgramFiles%...
Use "set <ENTER>" in a DOS-Box to see what is there already.
Next try e.g.
"C:\Program Files\Adobe\Acrobat Reader DC\Reader\AcroRd32.exe"
and 
"%ProgramFiles%\Adobe\Acrobat Reader DC\Reader\AcroRd32.exe"

So you could add your own system environment variable like:   SET esfolder=C:\Tools\Everything\
Next you could use:   %esfolder%\es.exe ....


Google for more information about SET as that is only set and work for current open DOS-Box or running batch, unless you really set it persistent as system-wide environment variable




Hope that info is from use
User avatar
tuska
Power Member
Power Member
Posts: 3740
Joined: 2007-05-21, 12:17 UTC

Re: Export all folders/subfolders/files to CSV with file details(modified,created,size,extension)

Post by *tuska »

2Stefan2
Thank you very much for your comments and explanations!
But I will leave it at the two above mentioned solutions, because they are completely sufficient for my purposes.
User avatar
tuska
Power Member
Power Member
Posts: 3740
Joined: 2007-05-21, 12:17 UTC

Re: Export all folders/subfolders/files to CSV with file details(modified,created,size,extension)

Post by *tuska »

Stefan2 wrote: 2019-06-05, 18:56 UTC
tuska wrote: 2019-06-05, 18:25 UTC I wanted to enter this in the TC command line:
es.exe D:\Data\WINWORD\ -date-modified -date-created -size -extension -export-csv results.csv

I got the following error message:
"es.exe" could not be found.
Make sure you entered the name correctly and repeat the process."
You have to enter the full path to the folder with the es.exe: C:\Tools\Everything\es.exe D:\Data\WINWORD\ ...
Unfortunately, another attempt showed that this variant does not work with the TC command line or DOS window.
In the file "results.csv", only the field headings are displayed.
--> The reason for my misconception was a mistake in the path:
D:\Data\WINWORD\ (as an example in the forum) <-> D:\Daten\WINWORD (on my PC).
Thus the entry in the TC command line works as described above when specifying the complete path to es.exe.

Therefore, I have applied one of your suggested solutions as follows:
1. TC commandline: cmd <enter>
2. SET esfolder=C:\Tools\Everything\ <enter> (in DOS-window)
3. %esfolder%\es.exe D:\Data\WINWORD\ -date-modified -date-created -size -extension -export-csv results.csv <enter> (in DOS-window)
4. results.csv for D:\Data\WINWORD\ was created in the path shown in the DOS window(!)
5. exit <enter> -> closes the DOS window

Important:
Both point 2. and point 3. must be run again after each closing of the DOS window to get the file "results.csv"!
If the DOS window remains open after the first run, then it suffices to execute point 3. for another modified query.
Post Reply