Page 1 of 1

How can I know a file is ready?

Posted: Wed Apr 13, 2011 9:36 am
by giantjupiter
Hi,

I have a php module which watches a folder, and when a file is shown in the folder, the module will process the file.

The file could be very large, and need some time to be written completely into the folder. The watching module could detect the file when the file is written partially into the folder, and it should wait until the file is completely written.

So the problem here is that how the watching module can learn the file is partial or complete?

A file lock may work, but I need a solution simpler? Is there any file property which I can test to learn the file status.

Thanks,

Re: How can I know a file is ready?

Posted: Wed Apr 13, 2011 5:31 pm
by incubi
Just guessing, but one way would be to look at the file attributes for something that tells you its done.
You'll need to do some testing and you can get more file info if you're on Linux.

Here's a place to start
http://answers.yahoo.com/question/index ... 055AAZxNwb


Lee