Re: guess the file size of compressed file from the original
Re: guess the file size of compressed file from the original
- Subject: Re: guess the file size of compressed file from the original
- From: Bill <email@hidden>
- Date: Sun, 27 Jun 2004 10:24:12 +0800
What is the eventual purpose of doing this? Will you need to be able
to open each zip file individually or are you splitting them up and
then planning to re-join them before un-archiving them?
Ken,
Great ;) I haven't think of disk image.
Well, let's start from the purpose: using Gmail as an "alternative
backup". Currently, I used a script to zip every file of a chosen
folder, then send them out as email attachment. Each email subject is
the path (Mac style) of the file, body is the backup time.
At this moment, I need to avoid file bigger than 5MB, pick them out by
hand, because my ISP limits each email must be smaller than 5MB.
My experience of Gmail is that their search engine is excellent ;)
Using file name or subfolder name, I get what I want to find.
Inspired by your idea, I'm thinking of making disk image of big file,
split it into 5MB segment, zip the segment. For small file, just zip
it. Or, to make disk image from the chosen folder, split it into 5MB
segment, and set the body of email to list of items contained.
Ken, what's your suggestion?
TIA
bill
PS: Below is my current script:
---------------------------
-- Ask user to choose a folder, get a list of *every* files recursively
set sourceFolder to quoted form of (POSIX path of (choose folder with
prompt "Choose the folder to backup:"))
-- list of backup files, without dot files and "Icon^M"
set backupList to every paragraph of (do shell script "find " &
sourceFolder & " -type f ! -name '.*' ! -name 'Icon?'")
repeat with i in backupList
tell application "Mail"
launch
-- compose subject & body
set theSubject to quoted form of (contents of i) as POSIX file as
Unicode text
-- make the time stamp in ISO8601 format
set theBody to do shell script "date +'backup on '%Y%m%dT%H%M%S"
-- zip the target file
set tmpZip to (POSIX path of (path to temporary items) &
"archive.zip")
do shell script "/usr/bin/ditto -c -k --sequesterRsrc " & quoted form
of (contents of i) & space & tmpZip
-- compose message
set newMessage to make new outgoing message with properties
{subject:theSubject, visible:false, content:theBody}
tell newMessage to make new to recipient at end of to recipients with
properties {address:"email@hidden"}
-- make attachment
tell newMessage
tell content
make new attachment with properties {file name:tmpZip as POSIX file
as alias} at after the last paragraph
end tell
end tell
send newMessage
end tell
delay 1
end repeat
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.