<<SNIP>> >> >> So I suppose I want to do a locate, rename, move. 1) locate all >> "output.txt" files on the hard drive; 2) rename each "output.txt" to >> something unique, and 3) move each renamed file from its original >> location >> to a single directory. >> >> I have tried a few ways with no success. Thanks for the help. > > UNTESTED (sorry I don't use Windows): > > > my $dir = '/renoutput'; > mkdir $dir or die "mkdir '$dir' $!"; > > my $count = 1; > > for my $file ( glob '/*/output.txt' ) { > rename $file, "$dir/output" . $count++ . '.txt' > or die "Cannot rename '$file' to '$dir/output$count.txt' $!"; > } > >
ARRGHHHH!!!! OMG!!! I had code that was very close to this... but I was using the wildcard (*) in an attempt to rename the file. Basically, where you have " . . . "$count++ . '.txt' ..." I was using "$count++ . 'outp*.txt'. . ." When I removed the wildcard, everything worked perfectly. I now have a directory named c:/renoutput with 522 files numbered output1 through output 522. Thanks a million. Worked great and my project is close to getting done. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>