Jul 22, 2011
leala

Use the Automator to Extract a list of Filenames to a Txt file

The MAC OS Automator is the swiss army knife of tools, just take a look at these “10 Awesome Uses for Automator” and I often wonder how I lived without it. In my line of work, sometimes I need to extract a list of filenames contained on a CD or a directory and dump them into a text file for analysis. Lucky for me the automator makes this task super easy and painless. You too can enjoy this in 6 easy steps.

Step 1

Fire up Automator and select File > New > Custom
Screenshot - MAC Automator Custom Selection

Step 2

Create your Automation by dragging commands, called actions, into the Automator workspace starting with “Ask for Finder Items”.

Screenshot - MAC Automator Action

Step 3

Drag over “Get Folder Contents” from the Action list to the automator workspace. For my purposes I usually check the “Repeat for each subfolder found” depending on how deep you need to go, but I usually want EVERYTHING.

Screenshot - MAC Automator Workspace

Step 4

Drag over “New Text File” from the Action list to the automator workspace. Add a “save as” title to your text file if you want and then, put it where you want. I usually put it right on my “Desktop”.

Screenshot - MAC Automator Text

Step 5

Time to run it and see if it works. Hit the “Run” (play) button in the top right-hand corner and watch the magic happen. If all works according to plan you will get a dialog box that asks you where you want to look for your dump. In the example below I want to extract a list of the file contents of my Alpha One Labs project directory.

After hitting play, If everything worked you should have an output of the filenames contained in the directory as a text file on your desktop. Remember to save it and now you can extract to you hearts content, whenever you need.

Screenshot - MAC Automator Dialog

Step 6 (optional)
I generally import the txt file into something like Excel via “File > Import > txt file” with the forward slash as my delimiter so I can work with the information better.

Screenshot - Excel Text Import Dialog

1 Comment

  • Awesome! Thanks so much for that. I’ve been putting off inventorying my folders because any method I could think of would be rather time consuming. I’m new to Macs, and didn’t know anything about the Automator – looks like a great geeky feature I should be able to explore further and find even more goodies. :) Thanks again!!

Leave a comment

About me:

Metadata and Taxonomies are my thing. I spend an awful lot of time drinking coffee and having existential dilemmas on how to categorize myself. I like technology and humans, but only at the same time (HCI). You can find me out in the real world picking locks (only ones that belong to me), watching Doctor Who or playing soccer.

Nerdy things I blog about for other nerds: metadata and taxonomies, digital asset management (DAM), technology transitions and business change, professional development, social media privacy, and usability for information retrieval.

Disclaimer: This is a personal weblog and does not represent the thoughts, intentions, plans or strategies of my employer (any of them). It is solely my opinion lame as it may be.