Re: checking folder size with Finder
Re: checking folder size with Finder
- Subject: Re: checking folder size with Finder
- From: Jay Louvion <email@hidden>
- Date: Fri, 27 Oct 2006 12:24:14 +0200
- Thread-topic: checking folder size with Finder
Title: Re: checking folder size with Finder
On 27.10.2006 12:20, "ishmael" <email@hidden> spake thus:
> hi everyone,
>
> i'm writing a simple script that, periodically, check for new files
> and folders in a specific folder on a remote server (windows server),
> and copy them on another server (mac).
> To avoid starting copying files and folder while they are been copying
> by users into the origin-server, I use the handler below to check that
> the dimension of the file/folder is not changing over a 2 second
> period.
>
> It works well when moving single files; a problem arises with folders.
> If a user is copying into the origin-server a folder containing some
> big file (that takes more than 2 seconds to copy), the handler fails,
> thinking the dimension of the folder is constant, and let the script
> starts to copy the folder. I tried to raise the waiting time, but the
> problem is still there: if someone is copying from a remote server a
> folder, and the copy of a single file inside the folder took more than
> expected, the script fails.
>
> It seems that the property "size of" a folder is updated after the
> copy of a file inside the folder is completed, and not during the
> copy.
>
> Does anyone has ever been doing something like that? Every suggestion,
> help, fierce criticism at the silliness of my script, would be really
> appreciated!
>
> thanks,
>
> Mauro
>
> --from the idle handler
> set item_info to info for elem --elem is an alias: file or folder
> checkSize(folder_remote as string, name of item_info, size of item_info) of me
> --
>
>
> on checkSize(this_folder, file_name, sz)
> tell application "Finder"
> try
> repeat
> delay 2
> set sz1 to size of (info for alias (this_folder & file_name))
> if sz = sz1 then exit repeat
> set sz to sz1
> display dialog "Size of " & file_name & " is still changing: " &
> sz1 giving up after 3
> end repeat
> on error error_message number error_number
> display dialog the error_number & ". " & the error_message giving up after 10
> end try
> end tell
> end checkSize
If I may just suggest not too short a delay time so that it doesn’t overlap your display dialog giving up time.
Cordialement,
j.
Jay Louvion
Studio Casagrande
3, rue Müller-Brun
1208 Geneva
T+4122 840 3272
F+4122 840 3271
skypeme:
jaylouvion
www.studiocasagrande.com
P Please consider the environment before printing this email.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/mailman//archives/applescript-users
This email sent to email@hidden