By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,007 Members | 1,066 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,007 IT Pros & Developers. It's quick & easy.

Monitoring and copying files

P: 12
HI

I am running Active Perl on a Windows XP machine.

I am hoping to get some advise on a strategy to monitor and copy files that are arriving in a directory and need to be copied to a second location. Files will arrive at the rate of one every 2 to 4 seconds into a directory immediately below the parent. The number of files written to each directory will vary and the number of directories written will also vary (typically the number of files will be < 5,000 and the number of directories < 50). All files will be written to a directory before the next directory is created. I do not want to wait until all the files arrive before copying them. Ideally I need to monitor the parent directory for new files and directories and copy them as they arrive.

I am thinking of using File::Find to check for both directories/files as the files are arriving. I think that this will create a lot of overhead especially as the number of directories/files increase and I have to check after each file - assuming that the copy can keep up with the arrivals.

I have no source code as I am looking for general advice.

Any suggestions on a more efficient approach?
Feb 1 '07 #1
Share this Question
Share on Google+
2 Replies


KevinADC
Expert 2.5K+
P: 4,059
maybe you should look into setting up a "task" and using a batch file instead of trying to write this in perl.

You could maybe use the File::Path module instead of File::Find to move a tree to another directory.

http://perldoc.perl.org/File/Path.html
Feb 1 '07 #2

P: 12
Thanks for the suggestions. I will give them a try!

Cheers
Feb 2 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.