The_Dj has asked for the wisdom of the Perl Monks concerning the following question:
Greetings Monks.
I need to watch for files appearing, dissapearing or changing.
My environment is Windows (several server versions) and Strawberryperl 5.18.
I also need to be as resource-light as possible as many target servers run at close to or over loaded.
Naturally Win32::FileSystem::Watcher seems to be the best solution since it does evrything I need
But I have a strange problem:
While the watcher is watching a directory any attempt to rename a file is met with a popup 'cannot rename <file> it is being used...'.
However I can create, modify or delete with no problems.
I'm testing with a very simple program:
I need to watch for files appearing, dissapearing or changing.
My environment is Windows (several server versions) and Strawberryperl 5.18.
I also need to be as resource-light as possible as many target servers run at close to or over loaded.
Naturally Win32::FileSystem::Watcher seems to be the best solution since it does evrything I need
But I have a strange problem:
While the watcher is watching a directory any attempt to rename a file is met with a popup 'cannot rename <file> it is being used...'.
However I can create, modify or delete with no problems.
I'm testing with a very simple program:
Any help?use Win32::FileSystem::Watcher; my $watcher = Win32::FileSystem::Watcher->new("c:\\test"); $watcher->start(); while (1) { my @entries = $watcher->get_results(); foreach my $entry (@entries) { print $entry->action_name . " " . $entry->file_name . "\n"; } sleep 2; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Watching for files to change
by kcott (Archbishop) on Nov 09, 2013 at 17:35 UTC | |
by The_Dj (Beadle) on Nov 10, 2013 at 07:22 UTC | |
by kcott (Archbishop) on Nov 10, 2013 at 13:58 UTC |
Back to
Seekers of Perl Wisdom