Replacement for Tanaka's MT List Files?

I’m porting a large AppleScript to OS X and am trying to replace the functions of Tanaka’s MT List Files and MT List Folders commands. Those were great because you could retrieve a list of files of a particular file type from all sub folders in one line without having to loop or walk thru them. Does anyone know of a way to do this in OS X with the same ease?



Satimage osax has a list files command that will work recursively.

It might also be possible to use shell scripting but I have nothing to offer since I’m still a relative noob in the shell.

– Rob

If all of the files have the correct extension, then the unix find command would be a good choice:

find ~/Documents/ -name ‘*.xls’

for example, would find all xls files in the Documents directory in the user’s home.

I would suggest playing with the script in the terminal before trying to write it in AppleScript.

This sort of works for me:

I say sort of because the result returns an extra forward slash after the Documents folder (e.g., “/Users/jon/Documents//MyFile.xls”). Also, from this list, if you aren’t passing this to other shell scripts, you’ll probably still need to traverse the list to convert to Mac-style colon delineated paths. Find is very powerful and defaults to go all the way down a directory path to all subfolders. To limit to just the folder specified, add the “-maxdepth 1” flag. Other flags can also be added to find files based on size or date or more powerful regex.


Jon, try this to rid yourself of the additional slash…

from man tr…

Thanks, Greg. Anyone know why we get the double forward slash in the first place?


Once again with a ‘colon deliniated’ path…

It looks like “POSIX path” is putting a / at the end. In the you can use this and it will not give you the double slashes…

find '/Users/myusername/Documents' -name '*.xls'
--but if you use ...
/Users/myusername/Documents/ -- it will show the double slashes