Jonathan8 Posted February 4, 2007 Share Posted February 4, 2007 (edited) Hi everyone, I am new to AppleScript and have recently created a back-up script, based on a tutorial written in the book "AppleScript: The Missing Manual". I've also read and did all the excercises present in "AppleScript for Absolute Starters", which means I have some basic understanding. What I would like to do is to compress the backed-up folder (preferably by automatically making a .zip archive and then a dialog w ndow where I wish to save the .zip file) I've searched some other forums (including this one), but I can't get it to work. Here is the relevant bit of my code: (...) set tempVar2 to display dialog "Would you like to compress your Opera preferences folder (using zip)? This file could be opened on almost any Mac or PC." buttons {"No", "Compress"} default button 1 set theButtonPressed to button returned of tempVar2 if theButtonPressed is "Compress" then do shell script ¬ ("/usr/bin/ditto -c -k -rsrc --keepParent " & ¬ selectedFile & " " & (choose folder)) else (...) Any suggestion is welcome, even another type of compression (although a compression method that could be opened on many computers is preferred). Thank you very much in advance. Edited February 4, 2007 by Jonathan8 Link to comment https://www.insanelymac.com/forum/topic/41101-how-to-compress-folders-with-applescript/ Share on other sites More sharing options...
A Nonny Moose Posted April 18, 2007 Share Posted April 18, 2007 it would be easier to create an Automator workflow and then save it as a plugin for the Finder. Or just use the Finder's "create archive" command in the menu. Link to comment https://www.insanelymac.com/forum/topic/41101-how-to-compress-folders-with-applescript/#findComment-349265 Share on other sites More sharing options...
PascalW Posted April 19, 2007 Share Posted April 19, 2007 Hi everyone, I am new to AppleScript and have recently created a back-up script, based on a tutorial written in the book "AppleScript: The Missing Manual". I've also read and did all the excercises present in "AppleScript for Absolute Starters", which means I have some basic understanding. What I would like to do is to compress the backed-up folder (preferably by automatically making a .zip archive and then a dialog w ndow where I wish to save the .zip file) I've searched some other forums (including this one), but I can't get it to work. Here is the relevant bit of my code: (...) set tempVar2 to display dialog "Would you like to compress your Opera preferences folder (using zip)? This file could be opened on almost any Mac or PC." buttons {"No", "Compress"} default button 1 set theButtonPressed to button returned of tempVar2 if theButtonPressed is "Compress" then do shell script ¬ ("/usr/bin/ditto -c -k -rsrc --keepParent " & ¬ selectedFile & " " & (choose folder)) else (...) Any suggestion is welcome, even another type of compression (although a compression method that could be opened on many computers is preferred). Thank you very much in advance. You could use this: do shell script "zip -r -j "& ZipFolder&" "& ToBeZippedFolder &"" where ZipFolder coud be something like set zipfolder to (POSIX path of (choose folder with prompt "Where do you want to store the zip file?") & "nameofyourzipfile.zip") and ToBeZippedFolder set ToBeZippedFolder to (POSIX path of (choose folder with prompt "Choose the folder you want to zip")) Link to comment https://www.insanelymac.com/forum/topic/41101-how-to-compress-folders-with-applescript/#findComment-349952 Share on other sites More sharing options...
Recommended Posts