• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
checking folder size with Finder
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

checking folder size with Finder


  • Subject: checking folder size with Finder
  • From: ishmael <email@hidden>
  • Date: Fri, 27 Oct 2006 12:20:15 +0200

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 _______________________________________________ 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
  • Follow-Ups:
    • Re: checking folder size with Finder
      • From: Jay Louvion <email@hidden>
  • Prev by Date: Re: Writing to file as UTF8 with BOM ?
  • Next by Date: Re: checking folder size with Finder
  • Previous by thread: Re: objectspecifiers question (very basic)
  • Next by thread: Re: checking folder size with Finder
  • Index(es):
    • Date
    • Thread