Zip Files, move to New Folder, rename and delete original files

Hi,

I trying to do the following:

A) Zip the files in the “Server HD/Library/Filemaker Server/Data/Backup/Daily” folder

B) Rename the the zipped file "FM_Daily_“Year_Month_Day”.zip i.e. 2014_07_05

C) Move the "“FM_Daily_“Year_Month_Day”.zip” to the “Server HD/Library/Filemaker Server/Data/Backup/Daily Zipped” folder

D) Delete all of the files in “Server HD/Library/Filemaker Server/Data/Backup/Daily” folder

How would this be Apple-scripted?

Thanks,

John

Hi,

the easiest way is to use the shell, zip rename and move can be accomplished at the same time

property backupFolder : "Server HD/Library/Filemaker Server/Data/Backup/"

set dailyFolder to backupFolder & "Daily"
set dailyZippedFolder to backupFolder & "Daily Zipped/"
set timeStamp to do shell script "/bin/date +%Y_%m_%d"
set ZIPfile to quoted form of (dailyZippedFolder & timeStamp & ".zip")

do shell script "/usr/bin/zip -jr " & ZIPfile & space & quoted form of dailyFolder
do shell script "/bin/rm -rf " & quoted form of dailyFolder & "/*"

Stefan,

I get the following error:

zip warning: name not matched: Server HD/Library/Filemaker Server/Data/Backup/Daily

zip error: Nothing to do! (try: zip -jr Server HD/Library/Filemaker Server/Data/Backup/Daily Zipped/2014_07_05.zip . -i Server HD/Library/Filemaker Server/Data/Backup/Daily)

What aM I doing wrong?

Thanks,

John

the path might be not valid.

If Server HD is the startup volume the path is "/Library/Filemaker Server/Data/Backup/
If Server HD is an external or shared volume the path is "/Volumes/Server HD/Library/Filemaker Server/Data/Backup/

Stefan/

That solved the problem.

When I hit RUN on Applescript it runs correctly

But now I have to put the script in the “/Library/FileMaker Server/Data/Scripts” folder, saved as “Backup.scpt”

When I double click the file it just opens the applescript program displaying the script.

How do I get Backup.scpt to execute when I select it?

Thanks,

John