How can I know a file is ready?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
giantjupiter
Forum Newbie
Posts: 1
Joined: Wed Apr 13, 2011 6:16 am

How can I know a file is ready?

Post 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,
incubi
Forum Contributor
Posts: 119
Joined: Mon Dec 07, 2009 1:47 pm

Re: How can I know a file is ready?

Post 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
Post Reply