[Pythonmac-SIG] Newbie needs Clues

Jack Jansen jack@oratrix.nl
Thu, 22 Mar 2001 21:38:25 +0100


This is more a Linux question than a Mac question, so you may get
better ideas if you ask in the general Python groups. Or even linux
groups.

But here's my $.10: in general there is no failsafe way to determine
whether a file is still being copied to on Unix. There are, however, a 
few things you could try:
- Try to lock the file. If the netAtalk server happens to use locking
this will work, and if you manage to lock the file it means the copy
has finished.
- Look at the modification time. Some unixes (don't know about Linux)
continually update the timestamp while the file is open for writing.
- Even if that doesn't work you could put a "reasonable" delay on the
modification time, i.e. if the file hasn't been modified in 20 seconds 
we assume it's complete.
- If you have control over the Mac side (i.e. because people use a
program of yours or an applescript to drop the file in the shared
folder) you could do the copy to a different filename ("tmp.NNNNN")
and then move that file to the final name when it's done. Then just
skip the tmp. files on the server side.
--
Jack Jansen             | ++++ stop the execution of Mumia Abu-Jamal ++++
Jack.Jansen@oratrix.com | ++++ if you agree copy these lines to your sig ++++
www.oratrix.nl/~jack    | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm