I recently needed a list of all files in a particular folder, actually the folder contained sub-folders also containing files. This tedious task becomes trivial with a couple of UNIX commands and Applescript provides a convienient user interface and the glue between the different UNIX commands.

The script is shown colour coded below. The first part of the script simply asks the user to choose the folder they want to print, and then generates a UNIX compatible POSIX path. The next part generates a temporary file to save the output into. 

The next dialog asks the user if they only want to print this folder or to include sub-directories. If the response is to only print this folder then the UNIX command:

Can be used to list the directory and send the output to the temporary file.

Alternatively the command:

Works recursively through the file structure listing all the files and formats the output into a multi-column format.

The next dialog checks if you want to print of save the output to a pdf file.

The final part of the script prints the temporary file or saves the pdf.

The script can be downloaded from here.

Last updated 10 April 2023

Related Posts