[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] VCard - Seek and destroy script



On Wed, 09 Aug 2000 14:47:15 +0200, Bart Lateur wrote:

>Gee, how hard can it be... using File::Find, traversing the system
>folder, deleting every file ending in ".vcf", possibly after checking
>the file info? It looks like a 10-liner to me. 

I got a mail today, from somebody who felt I had insulted a well
respected MacPerl guru. I do not consider Vicky Brown a beginner or a
dumb person. I can only guess that she's a bit afraid of destroying
files that should not be destroyed.

Well, time to put my code where my mouth is. If anybody has any idea why
the next snippet won't do, I'd like to know.

I don't know the file type or creator type of VCF files, or I would have
put in a test for that as well.

    #!perl -w
    use File::Find;
    use Mac::Files;

    sub exterminate{ 
        if(-d) {
           $File::Find::prune = 1 unless /Eudora/i;
        } elsif(/Eudora/i && /attach/i && /\.vcf($|\s+\d)/) {
            unlink $_;
        }
    }

    find \&exterminate, FindFolder kOnSystemDisk, kSystemFolderType;

__END__

-- 
	Bart.

# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org