#!/usr/bin/perl -w
use strict;
use File::Find ();
# -----------------------------------------------------------------------------
#
# Script
# find-junkFiles
# Description
# Search for "junk" files left over from editor, core, CVS, etc.
# - print filename only
sub wanted {
return unless -f $_;
if (
m{^\.?.+~$} ## editor backup
or m{^\#.+\#$} ## editor autosave
or m{^\.\#.+$} ## cvs replace update (eg, ".#test.c.1.3")
or m{^core(\.\d+)?$} ## core dump
) {
print "$File::Find::name\n";
}
## Traverse desired filesystems
for my $dir (@ARGV) {
no warnings 'File::Find';
warn "(**) checking '$dir' ...\n";
File::Find::find( { wanted => \&wanted }, $dir );