in reply to Re: Re: Re: FTP and File Copying
in thread FTP and File Copying

That isn't true if you broaden your toolset: utilities like fstat (on BSD), fuser (on Solaris), and lsof (on a wide variety of UNIX(ish) platforms, including the aforementioned) will all quite happily tell you whether a file is currently in use ...

perl -wle '@open = qx|fstat $ARGV[0] 2>/dev/null|; print "YES" if $#open > 0' somefile

(Error checking, and use strict;'ness left as an exercise to the reader. ;)

Unfortunately, because all of those only give you a snapshot of how things looked, none of them are going to help tell whether a file is incomplete or allow you to easily deal with the race condition that follows testing (ie, what if someone resumes an incomplete upload?), but that may be a more acceptable margin of error depending on your circumstances.

Another possibility lies with some of the more advanced (?) ftpd like NcFTPd, which supposedly support event reaction and/or notification. Theoretically, that means you could have the server kick off other processes when it thinks the files are finished uploaded instead of polling every half hour.

    --Kanji

Update: D'oh! Didn't see Fastolfe's response before I wrote this ... that'll teach me to post before reading the entire thread.