我刚收到help来获取所选文件夹的文件名。
tell application "Finder"
name of files of folder (choose folder) -- names of files
end tell
然而,我不能让这个工作为一个给路径,就像这个
set myfile to name of files of folder "~/Downloads/test/"
我用POSIX路径和其他人玩过很多次,但是我无法使用它。你能再帮我一次,谢谢。
答案 0 :(得分:3)
这应该可以解决问题:
tell application "System Events"
set downloadsFolder to path to downloads folder as text
-- display dialog downloadsFolder
end tell
tell application "Finder"
set myFileNames to name of files of folder (downloadsFolder & "test:")
log myFileNames
end tell
<强>此外:强>
set thisLocation to "/Volumes/Data/"
tell application "Finder"
set myFileNames to name of files of folder (thisLocation as POSIX file)
log myFileNames
end tell