I need to build a string containing the filenames of the 15 most recent files (by modification date) within a directory. Delimited only by a space:
file1.jpg file2.jpg file3.jpg
I'm using ImageMagick via command line. Here is what I currently have, but get an error number -1728:
tell application "Finder" set imageItems to every file of folder wallpaperPath set imageItems to the reverse of (sort imageItems by modification date) set concatFiles to "" repeat with n from 1 to 15 set imageItem to item n of imageItems set imageName to the file name of imageItem set concatFiles to concatFiles & " " & imageName end repeat end tell do shell script "cd " & wallpaperPath & "; montage " & concatFiles & " -tile 3x5 -geometry 500x500+1+1 ~/Desktop/final.jpg"