Reputation: 13
I have an Applescript to copy files from one directory to another destination automatically. As I am new in Apple Script and I am facing issue while copying file/folder into newly created folder.
set dt to (current date) as Unicode text
tell application "Finder"
make new folder at alias "Macintosh HD:Users:XYZ:" with properties {name:dt}
//In above code, new folder create automatically with system date and time on specified location like Tuesday, October 1, 2015 at 12/02/48 PM
copy folder "Macintosh HD:Users:XYZ:Desktop:ABC:" to folder "Macintosh HD:Users:XYZ:"
//In above code, I am facing issue that I am not able to copy file into created newly system date and time folder. How can I copy folder into newly created system date and time folder?
end tell
Can any one please help me?
Thanks in advance.
Upvotes: 1
Views: 562
Reputation: 285064
First of all, the Finder command to copy items is duplicate
.
make new folder
returns a reference to the new folder. Use this reference as destination.
set dt to (current date) as Unicode text
tell application "Finder"
set newFolder to make new folder at alias "Macintosh HD:Users:XYZ:" with properties {name:dt}
duplicate folder "Macintosh HD:Users:XYZ:Desktop:ABC:" to newFolder
end tell
Upvotes: 1