Can someone help please

I have an another earlier posting, but I have got a little further.

My script so far does the following-

It copies a folder on the Desktop to another local volume
It then creates a new folder with current date in same directory on that volume

I know need to move copied directory into new folder with current date and I need this to repeat every Friday.

tell application “Finder”
activate
select startup disk
open selection
select folder “My Folder” of desktop
copy selection to disk “My Disk”
end tell
set file_location to “My Disk:” as string
set the_date to current date
set the_month to month of the_date
set the_day to day of the_date
set folder_name to “” & the_month & " " & the_day
tell application “Finder”
set new_folder to (make new folder at folder file_location with properties {name:folder_name}) as alias
end tell

Any help would be much appreciated.

Thank you in advance.

Ian.

First, the entire block:

tell application "Finder" 
activate 
select startup disk 
open selection 
select folder "My Folder" of desktop 
copy selection to disk "My Disk" 
end tell 

Can (and should) be simplified to:

tell application "Finder"
  duplicate folder "My Folder" of desktop to disk "My Disk"
end tell

This shorter version doesn’t need the Finder to be active/frontmost, it doesn’t require selecting any objects or opening any windows.

Secondly, you say once copied you want to move the folder so a new folder on ‘My Disk’? Why not do it the other way around - create the folder first, then duplicate the folder directly into the folder:

tell application "Finder"
   -- code here to build folder name based on date
   set destFolder to make new folder at disk "My DIsk" with properties {name: folderName}
   duplicate folder "My Folder of desktop to folder destFolder
end tell

In this way you create the folder and store a reference to it in ‘destFolder’. This is then used as the target for the duplicate command and you’re guaranteed to duplicate the folder to the right place (assuming the create folder command worked). You’ll need to add error checking to make sure the folder creation worked.

As for the scheduling, it’s easier to this this outside of your script. Use one of the scheduling utilities such as cron or iDo to set a schedule of when your script should run.

Thanks Camelot

That streamlined my poorly written Applescript, however what I have now creates a Folder with Today’s date in the desired location and duplicates the source folder into the same location.

I can’t seem to get it to go into the folder with Todays date.

Anymore help would be great, thanks.

Ian.