Delete every file whose name ends in .bak: : unlink « File « Perl






Delete every file whose name ends in .bak:

    

#!/usr/bin/perl
use warnings;
use strict;
use File::Find;
find ( \&callback, "/") ;
sub callback {
    unlink $_ if /\.bak$/;
}

   
    
    
    
  








Related examples in the same category

1.The unlink function deletes a list of files on both UNIX and Windows systems.
2.Delete a file