我是新手,我正在寻求帮助:我有一段代码正在运行,但是想扩展它并且无法使其工作到目前为止:
我有这个在选定的位置创建一个项目文件夹,有两个文件夹和两个子文件夹:
`set JobName to text returned of (display dialog "Please enter Project Name:" default answer "New_Project")
set loc to choose folder "Choose Parent Folder Location"
tell application "Finder"
set newfo to make new folder at loc with properties {name:JobName}
set targetFolder to make new folder at newfo with properties {name:"01_folder"}
make new folder at targetFolder with properties {name:"01_sub1"}
set targetFolder to make new folder at newfo with properties {name:"02_folder"}
make new folder at targetFolder with properties {name:"02_sub1"}
end tell`
我有两个问题: 1.如何在子文件夹{name:" 01_sub1"}中创建子文件夹? 2.如何将文件移动到正在创建的文件夹之一? (我知道如何移动到固定路径但不是在同一脚本的过程中选择的路径)
我会非常感谢任何提示! 发言了
答案 0 :(得分:0)
你已经在其他方面做了这些,所以我不明白为什么你有问题。你有这一行:
make new folder at targetFolder with properties {name:"01_sub1"}
只需将其更改为捕获文件夹变量,就像这样...
set subFolder1 to make new folder at targetFolder with properties {name:"01_sub1"}
然后你可以将一个子文件夹放入...
set anotherSubFolder to make new folder at subFolder1 with properties {name:"another subfolder"}
请注意,您还会捕获该文件夹变量,因此您需要做的就是将文件移动到它...
move someFile to anotherSubFolder
我向您展示的所有内容都使用了您在代码中已经使用的相同逻辑。