the_slycer has asked for the wisdom of the Perl Monks concerning the following question:
If I add a print right before the move, $orig and $dest print out correctly.#!/usr/bin/perl -w use strict; use File::Copy; #rather than renaming my $path = "/home/ftp/pub/mp3s/"; #just in case move needs a full path chdir $path; my @lists = <mp3s?>; foreach (@lists){ open (FH, $_) || die "Could not read file :$!"; my $dir = $_ . "_dir"; mkdir $dir; #dir that we want to move the files into while (<FH>){ chomp; my $orig = $_; s!/.*/(.*/.*)!$1!; #keep last dir + file name in new dir my $dest = $path . $dir . "/" . $_; move $orig,$dest || die "Could not move $orig to $dest: $!"; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Moving?
by Fastolfe (Vicar) on Apr 14, 2001 at 04:34 UTC | |
by the_slycer (Chaplain) on Apr 14, 2001 at 05:13 UTC |