while( my $entry = readdir DIR ){ if( ((stat($entry))[9]+604800 <= $zeit) ){ $ftp->rmdir($entry, RECURSE); } }