Re: [PHP] Check for open file

2011-03-11 Thread Tommy Pham
On Fri, Mar 4, 2011 at 7:09 AM, Steve Staples sstap...@mnsi.net wrote: Depending on the size of the file, wouldn't this fall under the 2gb limitation on windows 32bit OS?  I ran into this problem on a project I was working on, and ended up switching to Python (but that is a WHOLE other

RE: [PHP] Check for open file

2011-03-04 Thread Arno Kuhl
-Original Message- From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] Sent: Thursday, March 03, 2011 2:03 PM To: sstap...@mnsi.net Cc: php-general@lists.php.net Subject: RE: [PHP] Check for open file As far as I was aware, if you're in the middle of writing to a file

Re: [PHP] Check for open file

2011-03-04 Thread Richard Quadling
On 3 March 2011 19:59, Ashley M. Kirchner ash...@pcraft.com 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

Re: [PHP] Check for open file

2011-03-04 Thread Daniel Brown
On Thu, Mar 3, 2011 at 14:59, Ashley M. Kirchner ash...@pcraft.com wrote:                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

Re: [PHP] Check for open file

2011-03-04 Thread Steve Staples
On Fri, 2011-03-04 at 09:55 -0500, Daniel Brown wrote: On Thu, Mar 3, 2011 at 14:59, Ashley M. Kirchner ash...@pcraft.com wrote: 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

RE: [PHP] Check for open file

2011-03-03 Thread Bob McConnell
From: Ashley M. Kirchner 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

RE: [PHP] Check for open file

2011-03-03 Thread Ashley M. Kirchner
Write the file with a temporary name and extension. Once the file is closed, change the name to the pattern your server is looking for. Once you finish processing it, either change the name again, or move it to a different directory. Don't reuse the same file name, but add a numeric value

RE: [PHP] Check for open file

2011-03-03 Thread Steve Staples
On Thu, 2011-03-03 at 13:23 -0700, Ashley M. Kirchner wrote: Write the file with a temporary name and extension. Once the file is closed, change the name to the pattern your server is looking for. Once you finish processing it, either change the name again, or move it to a different

RE: [PHP] Check for open file

2011-03-03 Thread Ashley Sheridan
On Thu, 2011-03-03 at 15:29 -0500, Steve Staples wrote: On Thu, 2011-03-03 at 13:23 -0700, Ashley M. Kirchner wrote: Write the file with a temporary name and extension. Once the file is closed, change the name to the pattern your server is looking for. Once you finish processing it,

RE: [PHP] Check for open file

2011-03-03 Thread Ashley M. Kirchner
As far as I was aware, if you're in the middle of writing to a file and another script was attempting to write to it, the OS would prevent that as you had an open lock on it. -- Thanks, Ash http://www.ashleysheridan.co.uk I guess I would have to test that. -- PHP General

Re: RE: [PHP] Check for open file

2011-03-03 Thread Peter Lind
On Mar 4, 2011 4:53 AM, Ashley M. Kirchner ash...@pcraft.com wrote: -Original Message- From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] Sent: Thursday, March 03, 2011 2:03 PM To: sstap...@mnsi.net Cc: php-general@lists.php.net Subject: RE: [PHP] Check for open file