DanielStead
Programmer
i currently have a perl script that moves files to a different location but i need to add a bit of code that will loop thourgh all the folders in the directory as there are like 5,000 folders in the directory
code currently looks like this
#!/usr/bin/perl
use File::Copy;
opendir(DIR, "X:/Tera 2-1 Main/P&G/Done") or die("directory not found");
@contents = readdir DIR;
foreach $listitem ( @contents )
{
if ( - $listitem )
{
$oldlocation = "X:/Tera 2-1 Main/P&G/Done/$listitem";
$newlocation = "Z:/test/$listitem";
move($oldlocation, $newlocation);
}
else
{
#do nothing
}
}
closedir DIR;
code currently looks like this
#!/usr/bin/perl
use File::Copy;
opendir(DIR, "X:/Tera 2-1 Main/P&G/Done") or die("directory not found");
@contents = readdir DIR;
foreach $listitem ( @contents )
{
if ( - $listitem )
{
$oldlocation = "X:/Tera 2-1 Main/P&G/Done/$listitem";
$newlocation = "Z:/test/$listitem";
move($oldlocation, $newlocation);
}
else
{
#do nothing
}
}
closedir DIR;