AppleScript中的简单移动文件



我四处寻找,确实找到了有效的代码,但我不明白为什么我的简单版本不起作用,而更复杂的版本起作用:

此代码不起作用,导致错误

"无法获取"的全部内容;Macintosh HD:用户:安德鲁:下载">

tell application "Finder"
move entire contents of DownloadsFolderAddress to StatementFolderAddress
end tell

但这个代码确实有效??

tell application "Finder"
set AllStatementsList to get every item of (entire contents of folder DownloadsFolderAddress)
move AllStatementsList to StatementFolderAddress
end tell

很奇怪为什么第二个例子有效而不是第一个

错误很明显:您无法获取文本字符串的内容。

第二个示例之所以有效,是因为您指定了folder
有时Finder可以推断类型,但最好始终指定它。

假设StatementFolderAddress也是到文件夹的HFS路径

tell application "Finder"
move entire contents of folder DownloadsFolderAddress to folder StatementFolderAddress
end tell

最新更新