Help for this page

Select Code to Download


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