Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Store files securely on a USB flash drive' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Store files securely on a USB flash drive
Authored by: kevin@mac.com on Aug 08, '06 12:11:25AM

I had the same experience with a sparse image growing even after deleting files.

Even though Mac OS X has this feature which is used with File Vault, Disk Utility doesn't have an option to compact a sparse image so I wrote the following script that when saved as an applicaton works great to compact a sparse image. Just drag and drop a closed sparseimage over the application.

==========================

set |warning| to display dialog
"To use this script, drag a Sparse Image over it." buttons {"OK"} default button 1

on open this_item
try
set this_item to quoted form of POSIX path of this_item
set Question to display dialog
"Would you like to compact this Sparse Image?" buttons {"Cancel", "Compact"} default button 1
if button returned of Question is "Compact" then
do shell script "hdiutil compact " & this_item
set dialog to display dialog
"Your Sparse Image has successfully been compacted." buttons {"OK"} default button 1
end if
on error the errMsg number the errNmb
if the errNmb is not 0 then

display dialog
"Please unmount the Sparse Image before compacting." buttons {"Cancel"} default button 1
end if

end try
end open



[ Reply to This | # ]
Store files securely on a USB flash drive
Authored by: kevin@mac.com on Aug 08, '06 12:36:53AM
To make it easier I put the script here http://homepage.mac.com/kevin/compact_sparse_image

[ Reply to This | # ]