Re: Moving large PDF files with Applescript
Re: Moving large PDF files with Applescript
- Subject: Re: Moving large PDF files with Applescript
- From: "John C. Welch" <email@hidden>
- Date: Tue, 31 Mar 2009 10:44:26 -0400
- Thread-topic: Moving large PDF files with Applescript
Title: Re: Moving large PDF files with Applescript
On 3/31/09 10:21 AM, "Mielke, Gary R (CGC)" <email@hidden> wrote:
We are currently using the following script to watch a Source Folder and move files into other folders. One problem that we are having is that when the files are being copied into the source folder, the script will try and grab the file before it is completely copied. Is there other ways to write the Applescript to watch for a file to make sure the file is completely copied before moving or is there another solution that would work better than Applescript? The files that we are watching are PDF files. Any suggestions, thoughts or ideas would be appreciated!
Ed’s solution is what I did for this, with slightly different syntax. You basically have to set a size comparison loop. The one I did, for the first versions of Virex on Mac OS X was:
repeat with x in added_items
set theFileInfo to info for x --get info for the downloading file(s)
set theBaseSize to size of theFileInfo --get initial size
delay 3 --wait 3 seconds
set theFileInfo to info for x --get info again
set theCompareSize to size of theFileInfo --get a newer size
repeat while theCompareSize ≠ theBaseSize --if they don't equal, loop until they do
set theBaseSize to theCompareSize --new base size
delay 3 --wait three seconds
set theFileInfo to info for x --get info
set theCompareSize to size of theFileInfo --get a newer size
end repeat --once the sizes match, the download is done
But the general idea is the same, since there’s no reliable way to see if a file is done being moved/copied into a folder from the finder et al.
--
"We ain't making no goddamn corn flakes here."
Col. Charlie Beckwith, founder of Delta Force
_______________________________________________
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/archives/applescript-users
This email sent to email@hidden