Scott Rossi wrote:
>Recently, Dave Cragg wrote:
>
>>>  # tSourcePath and tDestPath are source and destination paths
>>>  open file tDestPath for binary write
>>>  put url "file/binfile:" & tSourcePath into tSourcePath
>>>  write tSourcePath to file tDestPath
>>>  close file tDestPath
>>>
>>>  Am I missing something?
>>
>>  Is the "file/binfile:" part a legit format? I've never seen that before.
>>
>>  However, is it not simpler to do this?
>>
>>  put url ("binfile:" & tSourcePath) into url ("binfile:" & tDestPath)
>
>If using the above, how do you do apply a diskspace check to make sure there
>is enough diskspace to write the file?  Or do you just try to write the file
>and see what happens in the result?

Basically, yes. Something like:

try
   put url ("binfile:" & tSourcePath) into url ("binfile:" & tDestPath)
   if the result is not empty then throw the result
catch pErr
   ## do whatever here
end try

However, this doesn't specifically do a disk space check. More 
typically, the errors I deal with are having the read only attribute 
set on the destination file (when overwriting), or the wrong 
permissions on network files.

But how does using "write" make it easier to do a space check?

Going back to your original script, it may need parentheses around 
the url descriptors. I forget the precedence of operators in 
Metacard, but I've been caught out like this before. Also, although 
it should work, I wondered why you used the same variable for the 
path and the data retrieved from it. (It might cause trouble if you'd 
used tSourcePath in a similar way before this part of the script.)

Does this work?

open file tDestPath for binary write
put url ("binfile:" & tSourcePath) into tSourceData
write tSourceData to file tDestPath
close file tDestPath

Cheers
Dave Cragg

Archives: http://www.mail-archive.com/[email protected]/
Info: http://www.xworlds.com/metacard/mailinglist.htm
Please send bug reports to <[EMAIL PROTECTED]>, not this list.

Reply via email to