- or download this
#!usr/bin/perl
...
# Date: 6 July 2002
use strict;
- or download this
my $path = './';
die "The file $base_file does not exist!\n" if (!-f $base_file);
- or download this
# Initiate the recursion
&RecurseDirs($path);
- or download this
recurseDirs($path);
- or download this
rm temp;
- or download this
unlink "temp.txt";
- or download this
sub RecurseDirs
{
...
my $file; #Variable for a file
foreach $path($path){
- or download this
opendir (DIRECTORY, $path) || die "Can't read $path\n";
- or download this
my @files = readdir(DIRECTORY);
- or download this
if (-d "$path$file/") { #If it's a directory...
- or download this
$path find -type f >temp.txt;
- or download this
system("find", "$path -type f -atime +180 > temp.txt");
- or download this
$str = wc temp -l;
$unused = int::substr($str, 0, 1);
#returns the first character as an int
- or download this
# Count files in dir
$path find -type f >temp.txt;
$str = wc temp -l;
$count = int::substr($str, 0, 1); #returns the first
#character as an int
- or download this
# Yes: write full dir path to file
if (($unused * 2) > $count){
$path >>result.txt;
}
- or download this
#!/usr/bin/perl -w
use strict;
...
}
return @old;
}