1
基本上,我试图在Automator中创建一个文件夹操作,因此无论何时将文件添加到特定文件夹,它都会创建一个与文件名匹配的子文件夹(没有扩展名),然后将文件移动到该子文件夹中。AppleScript:从文件名创建新文件夹并将文件移动到该文件夹中
到目前为止,我已经成功地使用了本网站的一篇文章(Create new folder named with a specified file name in Automator)来创建一个脚本来创建新文件夹。但是,我一直无法修改脚本将原始文件移动到新文件夹中。
任何帮助,将不胜感激。以下是我正在参考的完整脚本:
on run {input, parameters} -- make new folders from base file names
set output to {}
repeat with anItem in the input -- step through each item in the input
set anItem to anItem as text
tell application "System Events" to tell disk item anItem
set theContainer to path of container
set {theName, theExtension} to {name, name extension}
end tell
if theExtension is in {missing value, ""} then
set theExtension to ""
else
set theExtension to "." & theExtension
end if
set theName to text 1 thru -((count theExtension) + 1) of theName -- the name part
tell application "Finder"
make new folder at folder theContainer with properties {name:theName}
set end of output to result as alias
end tell
end repeat
return input -- or output
end run
在此先感谢!