in reply to RE: Re: Moving directories
in thread Moving directories
If you want to move whole trees then you could do something using File::Find. Something like this perhaps (untested)
--use File::Find; use File::Copy; my $src = '/some/directory/'; my $tgt = '/some/other/directory/'; find($src, \&move_it); sub move_it { if (-d $File::Find::name) { $File::Find::name =~ s/$src/$tgt; mkdir $File::Find::name, 0777 unless -d $File::Find::name; } else { my $new = $File::Find::name; $new =~ s/$src/$tgt; copy($File::Find::name, $new); } }
|
|---|