Hello all,

I want a script to move all 'expired files' to a folder.
So I wrote the script below.

However, a problem came out: the find function run everything
in the address, including the entire folders structure!!!

I want to move those files and files only. What can I do?
(*note: the OS is Windows XP )



<the script>
use File::Find;

@target_directory = "C:\\temp";
$expire_time = time - 3600;
$expired_dir = "C:\\temp\\temp\\";

print "time now is ", time,"\n";
find (\&action, @target_directory);


sub action
{
my @file_stat = stat($File::Find::name);
if ( $file_stat[9] > $expire_time )
{
$origin_dir = join("\\", split ("/", $File::Find::name));
print "the stat of $origin_dir is $file_stat[9]\n";
print "move \"$origin_dir\" \"$expired_dir\" \n";
system ("move \"$origin_dir\" \"$expired_dir\"");

}
}
</the script>

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to