in reply to Re: sorting a directory
in thread sorting a directory
sub make_space { my $folder_name = $_[0]; opendir DIR_HANDLE, ".$folder_name"; my @filelist = readdir DIR_HANDLE; close DIR_HANDLE; foreach $filename(@filelist) { $st = stat($ilename) $actime = st->$atime } #custom sort routine to sort the filelist according to their last acce +ssed date @sorted_list = sort { ($actime{$a}) > ($actime{$b}) } @filelist; #deleting 1st 100 entries in the sorted array for($i =0; $i <=99 ;$i=$i+1) { unlink($sorted_list[i]); } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: thanx a lot guys
by superfrink (Curate) on Dec 27, 2004 at 10:23 UTC |