Folder Content List

Joined
Nov 19, 2006
Messages
1,781
Reaction score
81
Points
48
Location
York, UK
Your Mac's Specs
iMac: 5K 27” (2020), 3.3 GHz, 32Gb RAM. iPad2, iPad mini4, iPhone 13 Mini, Apple Watch SE
Is there any way to export a folder (and ideally sub folders) content list to,say, a .CSV file. I would like the file names, creation date and size and I don't mind if all the sub folder contents are listed in one long list.
 
Joined
Mar 17, 2008
Messages
6,879
Reaction score
191
Points
63
Location
Tucson, AZ
Your Mac's Specs
Way... way too many specs to list.
If no one comes back with a way to do so from the GUI, I'll post a way to gain a text-file with this information from the command line.
 

vansmith

Senior Member
Joined
Oct 19, 2008
Messages
19,924
Reaction score
559
Points
113
Location
Queensland
Your Mac's Specs
Mini (2014, 2018, 2020), MBA (2020), iPad Pro (2018), iPhone 13 Pro Max, Watch (S6)
So, I fooled around with Automator and can get you part of the way if you're looking for a GUI option:
Screen Shot 2011-08-17 at 1.55.01 PM.png
That won't give you the creation date or size but it will print the name of every file (recursively) to a text document on your Desktop called "Untitled.txt."

There is of course "ls -lhR" from the command line that will print the date, size and name of each file in a particular folder (this is the command line way). To be honest though, I'm not sure if the date printed is the modified date or the creation date. I'll have to defer to Dysfunction here.
 
OP
Sawday
Joined
Nov 19, 2006
Messages
1,781
Reaction score
81
Points
48
Location
York, UK
Your Mac's Specs
iMac: 5K 27” (2020), 3.3 GHz, 32Gb RAM. iPad2, iPad mini4, iPhone 13 Mini, Apple Watch SE
Thanks guys. I've never managed to get Automator to do what I want but will try this if only for educational purposes. Dysfunction - do you have a command line option to go through the subfolders.
For what I need to do, I'm not too fussed exactly which date is picked up and having to do each subfolder in turn would not be a deal breaker - just a little time consuming.
 

vansmith

Senior Member
Joined
Oct 19, 2008
Messages
19,924
Reaction score
559
Points
113
Location
Queensland
Your Mac's Specs
Mini (2014, 2018, 2020), MBA (2020), iPad Pro (2018), iPhone 13 Pro Max, Watch (S6)
Would something like the following accomplish what you're looking for (I can always tweak it)?
Screen Shot 2011-08-18 at 9.47.07 AM.png
 
Joined
Mar 17, 2008
Messages
6,879
Reaction score
191
Points
63
Location
Tucson, AZ
Your Mac's Specs
Way... way too many specs to list.
find . -type d -exec ls -lh {} \; |cut -f6- -d ' ' would also work, depending on how you want it presented.

mikeMBP:testdir mike$ find . -type d -exec ls -lh {} \; |cut -f6- -d ' '

136B Aug 18 07:06 Live At The Whiskey A Go-Go
238B Aug 18 07:06 More Fun In The New World

3.1M Aug 18 07:06 X - Live At The Whiskey A Go-Go - Blue Spark.mp3
4.9M Aug 18 07:06 X - Live At The Whiskey A Go-Go - Johnny Hit And Run Pauline.mp3

3.2M Aug 18 07:06 X - More Fun In The New World - Breathless.mp3
2.8M Aug 18 07:06 X - More Fun In The New World - I See Red.mp3
2.8M Aug 18 07:06 X - More Fun In The New World - Poor Girl.mp3
3.1M Aug 18 07:06 X - More Fun In The New World - The New World.mp3
2.9M Aug 18 07:06 X - More Fun In The New World - We-re Having Much More Fun.m
 

vansmith

Senior Member
Joined
Oct 19, 2008
Messages
19,924
Reaction score
559
Points
113
Location
Queensland
Your Mac's Specs
Mini (2014, 2018, 2020), MBA (2020), iPad Pro (2018), iPhone 13 Pro Max, Watch (S6)
Mine is incorrect (according to your needs) - it should be the following:
Code:
ls -lH | awk '{print $3 "," $6 " " $7 " " $8 "," $9}'
which prints out the following:
Code:
,  ,
vansmith,21 Mar 23:20,main.py
To be honest, I wasn't sure how to get rid of the first line (which represents the file count printed back by the "-l" switch). If I did this with directories and attempted to do it recursively, I got the following:
Code:
,  ,
vansmith,20 Jul 13:50,src
vansmith,18 Aug 12:42,test.txt
,  ,
,  ,
,  ,
vansmith,21 Mar 23:20,main.py
In that case, test.txt and the "src" folder are at one level and the main.py file is in the src folder. After some fiddling, I have come up with the following:
Code:
ls -lHRh | awk '{if ($3 != "") print $3 "," $5 "," $6 " " $7 " " $8 "," $9}'
That outputs the following (as "user,size,modification date,file/folder"):
Code:
vansmith,102B,20 Jul 13:50,src
vansmith,0B,18 Aug 12:42,test.txt
vansmith,4.3K,21 Mar 23:20,main.py
The only final problem I see is that you have no way of telling what is in the src folder (as I noted, the "main.py" file is in that folder). If I figure that out, I'll report back.

Dysfunction's solution probably works better. I'm partly doing this for the learning now. ;)
 
Joined
Mar 17, 2008
Messages
6,879
Reaction score
191
Points
63
Location
Tucson, AZ
Your Mac's Specs
Way... way too many specs to list.
tree would be ideal for building this, too bad I do a 'which tree' and return null
 

vansmith

Senior Member
Joined
Oct 19, 2008
Messages
19,924
Reaction score
559
Points
113
Location
Queensland
Your Mac's Specs
Mini (2014, 2018, 2020), MBA (2020), iPad Pro (2018), iPhone 13 Pro Max, Watch (S6)
Just for you. Built it here - the instructions worked perfectly.
 
OP
Sawday
Joined
Nov 19, 2006
Messages
1,781
Reaction score
81
Points
48
Location
York, UK
Your Mac's Specs
iMac: 5K 27” (2020), 3.3 GHz, 32Gb RAM. iPad2, iPad mini4, iPhone 13 Mini, Apple Watch SE
Thanks everyone. For the record I found dydfunctions find command line did just what I wanted.
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top