对不起,AppleScripting完全是初学者。
我想做一件非常简单的事情,把文件从一个文件夹移到另一个文件夹。
tell application "Finder"
set this_folder to "Users:chris.nicol:Movies:SmartConverter:"
set this_list to every file of this_folder
repeat with i in this_list
--if i does not start with "x" then
move i to "users:chris.nicol:music:itunes:itunes media:automatically add to itunes:"
--end if
end repeat
end tell然而,我总是收到一个错误:

我尝试过不同的命令(计数、parentContainer等)在文件夹中,但是我得到了相同类型的错误。我试过不同格式的文件夹..。
对我做错了什么有什么想法吗?
谢谢你,克里斯
发布于 2013-09-19 16:17:51
简单的提示..。如果您想要找到正确的路径,您应该使用此方法,并在结果字段中查找正确的路径。您将看到硬盘驱动器的名称,Macintosh,是必需的。注意,如果您想要文件的路径,也可以使用“选择文件”。
(choose folder) as text接下来,您将看到的路径是一个字符串。Applescript将其视为字符串,而不是文件或文件夹的路径。因此,当您想要使用字符串作为路径时,必须将单词"file“或”文件夹“适当地放在前面,以使applescript正确地使用它。因此,您的脚本应该如下所示。请注意,move命令可以处理文件列表,因此不需要重复循环。
set this_folder to "Macintosh HD:Users:chris.nicol:Movies:SmartConverter:"
tell application "Finder"
set this_list to every file of folder this_folder
move this_list to folder "Macintosh HD:Users:chris.nicol:music:itunes:itunes media:automatically add to itunes:"
end tell发布于 2013-09-19 00:58:24
尝试:
set thisFolder to (path to movies folder as text) & "SmartConverter"
set thatFolder to (path to music folder as text) & "itunes:itunes media:automatically add to itunes"
tell application "Finder" to move files of folder thisFolder to thatFolder发布于 2013-09-19 00:24:41
您必须在其中一个文件夹中有一些不可见的或其他不可复制的文件。要么将类似without invisibles的内容添加到set this_folder行的末尾,要么完全摆脱循环,只需调用
move files of entire contents of this_folder to (the Add Automatically folder)https://stackoverflow.com/questions/18884398
复制相似问题