📅  最后修改于: 2022-03-11 14:48:10.900000             🧑  作者: Mango
foreach my $file (@files)
{
my $old = "$srcdir/$file";
my $new = "$dest/$file";
my $subdir = $file;
while (length($subdir)>0)
{
if (-d "$dest/$subdir")
{
$new = "$dest/$subdir/$file";
last;
}
chop($subdir);
}
rename($old, $new) or die "Move $old -> $dest failed: $!";
}