View Full Version : Compressing the sparse image file ...

08-31-2010, 03:19 PM

Every time a SD backup is made to a sparse image file, the file increases in size. I would like to automate this procedure by executing a shell script at the end of my backup.

I wrote a regular AppleScript that works well. Can somebody help me convert this script in SS language:

property imagesPathList : {"/Sauvegardes/SuperDuper/Duplication - iMacG5.sparseimage"}

tell application "Caffeine"
turn on
end tell

repeat with i in imagesPathList
set filePath to i
do shell script "hdiutil compact " & quoted form of filePath
end try
end repeat

tell application "Caffeine"
turn off
end tell


Robert Lespérance

P.S. Caffeine is an utility that can reset the system's idletime periodically, preventing the computer of going to sleep. I suspect that the shell script will not need these statements because SD does that already.

08-31-2010, 03:40 PM
Why not just run this using an iCal alarm, Robert, after the SD! backup has finished?

08-31-2010, 04:37 PM
Hi Dave,

Good suggestion ... I new that one.

I wanted to try out SD's options to execute a shell script after completion. Since I don't know shell scripting I thought that somebody out there could help me with this one.

This way, it would execute exactly after the backup, when source and destination are available. Since I don't know the exact time the backup would be completed, I wouldn't have again to awake the computer, launch the script, mount the destination folder and reset the idletime during execution.

Stated simply, everything would be much more simpler with SD's shell script execution feature.

Can you help me with this shell script ?



08-31-2010, 04:48 PM
You can't really do this in an after-copy shell script without it getting complicated, because the image isn't unmounted.

Remember you can set an alarm and it'll go off when the Mac wakes. It doesn't have to wake.