Richard Sanchez
Richard Sanchez

Reputation: 1

Applescript to catalog Filename and Filepath

I need track files being sent out to various vendors. I store them in a Filemaker database, but have been trying to develop more efficient ways to fill my database. I created an automator app to create this list for me, but since the "Filter Finder items" relies on Spotlight, it doesn't work on networked drives.

mcgrailm made a slick Applescript that helps me populate a list of the files themselves. This is sufficient for about 90% of my needs as usually I just need to keep a record that a file has been sent, but sometimes I need to also track the POSIX filepath to tell a recipient where on the drive the files are located.

mcgrailm's script was

tell application "Finder" set file_list to name of every file of entire contents of (choose folder with prompt "Please select directory.") end tell

Does anybody know how I can modify this script to give me the full POSIX filepath along with the filename? I tried modifying but my Applescript skills are pretty lacking. Thank you

Upvotes: 0

Views: 168

Answers (1)

vadian
vadian

Reputation: 285059

entire contents in Finder could be very slow. A much faster solution is

set theFolder to POSIX path of (choose folder with prompt "Please select directory.")
set file_list to do shell script "find " & quoted form of theFolder & " -type f ! -name '.*'"

the result is plain text. One full POSIX path per line.

If you want a list use

set file_list to paragraphs of (do shell script "find " & quoted form of theFolder & " -type f ! -name '.*'")

Upvotes: 0

Related Questions