I wrote a sync program between some folders.The requirement was that one folder needs to contain just the files from the directories and sub directories present in the three input folders and needn't carry over the directory structure.
For ease I decided to just copy the files recursively using file::find.Here is the program.
My problem is that this code works beautifully when i try using local folders.But if it is folders on the network, it doesn't give me any output as in it compiles, executes without any problems and shows the prompt again, but no files are copied. Could any one tell me what I can do to rectify this? Thanks Sandhya#!usr/bin/perl use strict; use File::Find; use File::Copy; my @location=("\\\\network1\\pics","\\\\network1\\fonts","\\\\network1 +\\forms"); my $new_location="\\\\network1\\Sol"; foreach my $location(@location){ find(\&force_move,$location); } sub force_move(){ my $file=$_; print "copying $File::Find::file from $File::Find::dir\n"; copy($file,$new_location) or warn "$!" ; } print "Hey , I am done!!!!"; sleep(2);
UPDATE
It works now. I have no clue what changed the behavior.And it didn't work when i had $file::Find::file .I instead just used $file that is assigned t the current value of $_. I used just the mapped network drive in the path and am printing out the file names so that i can figure out if it works or not.thanks
SandhyaIn reply to file::find problems accessing files on a network by smanicka
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |