Macworld Forums: Software to create spreadsheet of folders & files - Macworld Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Software to create spreadsheet of folders & files

#1 User is offline   ckphoto Icon

  • Newbie
  • Pip
  • Group: Members
  • Posts: 2
  • Joined: 24-May 09

Posted 24 May 2009 - 02:49 PM

I organize my photos by month and year, then inside that folder are subfolders for each event. I like this method and 95% of the time I can find what I need. But I have some nature photos and macros that don't relate to the month they were taken.

I want to create a document or spreadsheet that will list each folder and all the subfolders in it. I don't need the next level of folders as those are just unedited and edited. Is there a way I can do this without typing?

example...
folder: 08 december
subfolders: parade, cookie, Christmas, Atlanta
0

#2 User is offline   DaveSomers Icon

  • Newbie
  • Pip
  • Group: Members
  • Posts: 8
  • Joined: 17-February 09

Posted 25 May 2009 - 10:33 AM

It should be doable if you aren't afraid of a Terminal text prompt. Something like a ls -R > filename.txt and then open that up in a spreadsheet, splitting fields by slashes.

I haven't had to do this since moving to the Mac (since I've been using the software to manage it for me), but I did this all the time on DOS, and UNIX has the same commands available. If no one can jump in with a link / description with details, I can go try to figure it out next weekend...
0

#3 User is offline   ckphoto Icon

  • Newbie
  • Pip
  • Group: Members
  • Posts: 2
  • Joined: 24-May 09

Posted 25 May 2009 - 10:47 AM

I am not afraid of a Terminal prompt, I just don't know how to do it.
0

#4 User is offline   DaveSomers Icon

  • Newbie
  • Pip
  • Group: Members
  • Posts: 8
  • Joined: 17-February 09

Posted 29 May 2009 - 01:09 PM

Sorry I couldn't get back to this til today. Here's a draft of my approach.
(don't be frightened off ... it takes longer to read the steps than to accomplish them)
I'm working on a version of this complete with some screenshots, which will be found on my website - http://www.CrookedSpruce.net - Go to the HireDave page, and then click on Portfolio. (after a few days have passed)

Open Terminal
navigate to the top level directory that you want to gather the information on
Issue the command (following line)
ls -1pR > rawresults.txt
(ls is list, the -1 tells it to put one data piece per line, -p tells it to put a "/" at the end of a directory, -R tells it to recurse (follow the subdirectories), > directs the output somewhere other than your screen, and rawresults.txt is the name of that output file - it will create/write over that filename in the active directory.)
Issue the command (following line)
exit
(to leave terminal)

OPTION 1 (using Excel and TextEdit)
Start up MS Excel
file...open...
choose rawresults.txt as read-only
on the text import wizard 1, choose fixed width
on the text import wizard 2, remove all the field widths - we want to import each line as one field
on the text import wizard 3, leave data format as "general"
Finish
Insert a blank line at top
Highlight the entire worksheet (need this so lines after blank are included)
data...filter...AutoFilter
Choose the header dropdown and select "custom"
Choose "Does not end with" and type ":" (that's just a colon) in the space provided
Delete all those rows
(the rows that end with a colon are directories. - I'm making an assumption that your filenames don't end with a colon. If they do, then some human intervention would be required here)
Save as tab delimited text
Close the file

Start up TextEdit
Choose Edit...Find
Enter " in the Find field and nothing in the replace field
Replace all.
(when we did the save in Excel, it may have added quotes around some of the filenames that contain special characters, we want to pull those back out. I'm assuming that your directories don't include the quote character)
Save the file
Close the file

Start up MS Excel
file...open...
choose filteredresults.txt as readonly
On the text import wizard 1, choose "delimited"
On the text import wizard 2, uncheck all the proposed delimiters, and check "other", adding "/" in the space provided
On the text import wizard 3,
if you have labels that may be confused, highlight the columns and choose data format "Text"
highlight the first column and select "do not import" (it should all be ".")
file...save as
choose Excel Workbook and give it the name you want.

At this point, you should have what you want.
If there are too many levels, you can apply an autofilter on the additional fields to remove additional rows.

OPTION 2 (using Numbers and TextEdit)
In Numbers,
Open a blank worksheet
Arrange your desktop so you can see Finder with the rawresults.txt and Numbers at the same time.
Click and drag rawresults.txt to cell A1 (this is the really cool part of a fully integrated OS and applications)
Click "Reorganize" in the toolbar, select the second section, "show all rows that match the following" "Column A" "Ends with" ":"
(note that this is the reverse of the Excel version above, Numbers doesn't have the "Doesn't End with" option)
Edit...Select All...Copy
File...New...blank worksheet
Select cell A1
Edit...Paste Values
Share...Export...CSV...

Start up TextEdit
Choose Edit...Find
Enter " in the Find field and nothing in the replace field
Replace all.
(when we did the save in Numbers, it may have added quotes around some of the filenames that contain special characters, we want to pull those back out. I'm assuming that your directories don't include the quote character)
Enter , in the Find field and nothing in the replace field
Replace all.
(I'm assuming that your directories don't include the comma character)
Choose Edit...Find
Enter / in the Find field and , in the replace field
Replace all.
file...Save as TextExport.csv
Close the file

In Numbers,
Open a blank worksheet
Arrange your desktop so you can see Finder with the rawresults.txt and Numbers at the same time.
Click and drag rawresults.txt to cell A1 (this is the really cool part of a fully integrated OS and applications)
Delete Column A
Click "Reorganize" in the toolbar, select the second section, "show all rows that match the following" "Column A" "is not blank"
Edit...Select All...Copy
File...New...blank worksheet
Select cell A1
Edit...Paste Values
file...save as
give it the name you want.

At this point, you should have what you want.
If there are too many levels, you can apply another "Reorganize" on the additional fields to remove additional rows.



Let me know how it works out.

Dave Somers

www.crookedspruce.net
0

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

2 User(s) are reading this topic
0 members, 2 guests, 0 anonymous users