Re: Check for open file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 3 March 2011 19:59, Ashley M. Kirchner <ashley@xxxxxxxxxx> wrote:
>
>
> Â Â Â Â Â Â Â ÂIs there a clean or reliable way of checking to see if a
> file is still being written to before doing anything with it?
>
>
>
> Â Â Â Â Â Â Â ÂHere's the scenario: we have a Samba share that we can copy
> files to (from within Windows or Macs). ÂThe server picks up the file and
> does some processing of said file. ÂAt the moment this is all a manual
> process: we copy a file into the Samba share, wait for that to finish then
> go to a web page (on the server) and tell it to process the file that was
> just copied into the Samba share. ÂI'm trying to see if there is a way to
> automate this where a file, or multiple files, get copied into the share and
> the server picks them up and process automatically without needing any
> interaction.
>
>
>
> Â Â Â Â Â Â Â ÂCan PHP detect this, or should I look into some delayed
> process of checking the file's modified time stamp versus current time and
> not touch the file till a certain threshold has been reached (say 30 seconds
> difference?).
>
>
>
> Â Â Â Â Â Â Â ÂIdeas, suggestions, comments .
>
>

I have a similar issue with files coming from a scanner connected to
our network over a VPN. There end is only 10mb and the scans are
significant.

The one thing I found that I can rely on is the date the file was last modified.

I have a process to copy the files if the saved file is more than 10
minutes old. Locking didn't happen (the scanning didn't create the
file locked in any way).

It was quite easy to amend the file whilst it was being written to by
the scanner. Nothing I could do about that.

The 10 minute delay on reading the file was fine for us.


-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux