Create a list of file names from a folder on your Mac

Would you like to generate a text file listing all the files in a folder or series of folders on your Mac?

There are 2 ways I know to do this…

1. Using a free program called Text Wrangler

2. Using an AppleScript.

The second option is the easiest…

Open your Applications folder.

Open the Utilities folder.

Launch the AppleScript Editor application.

Paste this text (which I found on another site)…

property fileName : “File List.txt”

on run
choose folder with prompt “Get list of files from this folder:”
open {result}
end run

on open droppedItems
set ASTID to AppleScript’s text item delimiters
tell application “Finder” to launch

repeat with thisItem in droppedItems
if (folder of (info for thisItem without size)) is true then
set AppleScript’s text item delimiters to (ASCII character 13)
tell application “Finder” to set theList to entire contents of thisItem as text
set AppleScript’s text item delimiters to “”

try
open for access file ((thisItem as text) & fileName) with write permission
set theFileRef to result

write theList to theFileRef
close access theFileRef
on error errorMsg number errorNum
try
close access theFileRef
end try
display dialog “Error (” & errorNum & “):” & return & return & errorMsg buttons “OK” default button 1 with icon caution
end try
end if
end repeat

set AppleScript’s text item delimiters to ASTID
return true
end open

Click on the Run button.

Select the folder you want a list of files from. The script will do the job and save the resulting text file.

Look for the file “File List.txt” in that folder.

Here’s how I have used this AppleScript…

I have all my important files in a Dropbox folder.

I have folders there containing files I created using Pages, Keynote, QuarkXpress, and so on.

I now have a file in each folder containing a list of all the files there, which I can look through on my iPhone or iPad and add text notes to so I know what’s in the file. It certainly helps me keep organised and on top of things.

Do please share this content! :)
Christopher John Payne
 

Chris helps coaches, trainers and consultants to double or triple their net income by optimising their website, product funnel, pricing structure, and more. He lives just outside London, England. His main site is at christopherjohnpayne.com.