Applescript 如何在带有apple脚本的文件夹中获取最新创建文件的路径?

Applescript 如何在带有apple脚本的文件夹中获取最新创建文件的路径?,applescript,filepath,Applescript,Filepath,我想获取在文件夹测试中创建的最后一个文件的路径 set p to "/Users/palmglow/Documents/googledrive/orders/IFTTT/test" set a to POSIX file "/Users/palmglow/Documents/googledrive/orders/IFTTT/test/" set latestFile to last item of (sort (get files of (POSIX file "/Users/palmglow/

我想获取在文件夹测试中创建的最后一个文件的路径

set p to "/Users/palmglow/Documents/googledrive/orders/IFTTT/test"
set a to POSIX file "/Users/palmglow/Documents/googledrive/orders/IFTTT/test/"
set latestFile to last item of (sort (get files of (POSIX file "/Users/palmglow/Documents/googledrive/orders/IFTTT/test")) by creation date) as alias
尝试:


不客气。若要将答案标记为已接受,请单击答案旁边的复选标记,将其从空心切换为绿色。您没有包含Finder tell,也没有正确引用文件夹。
set myFolder to "/Users/palmglow/Documents/googledrive/orders/IFTTT/test"
tell application "Finder" to set latestFile to item 1 of (sort files of (POSIX file myFolder as alias) by creation date) as alias