Wait for directory changes in Windows XP?

S

Stephen

I am trying to write a Perl script that will watch a directory for MP2
files created by some TV recording software, then trigger some other
actions on each file that is created (eg convert them into MP3).

I have looked at ChangeNotify and AdvNotify. However, I think both of
these will trigger action as soon as the recording software STARTS writing
a file.

I want to trigger action when it has FINISHED writing the file.

In an Explorer window can see the file get opened and progressively growing
during the recording. There is no published API to lock the file, etc.

Any suggestions?
 
B

Brian Wakem

Stephen said:
I am trying to write a Perl script that will watch a directory for MP2
files created by some TV recording software, then trigger some other
actions on each file that is created (eg convert them into MP3).

I have looked at ChangeNotify and AdvNotify. However, I think both of
these will trigger action as soon as the recording software STARTS writing
a file.

I want to trigger action when it has FINISHED writing the file.

In an Explorer window can see the file get opened and progressively growing
during the recording. There is no published API to lock the file, etc.


You could use stat to monitor the size of the file every x seconds. If it
doesn't change for a while then the program has probably finished writing to
it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,121
Messages
2,570,712
Members
47,283
Latest member
hopkins1988

Latest Threads

Top