At 22:31 +0200 2000.08.10, Bert Altenburg wrote: >with Perl. However, in MacScripter's magazine >(http://macscripter.net/magazine.html) it is already in chapter 3 that we >provide an applescript to get rid of .vcf files. And now AppleScript is >10 times shorter (and 100 times easier to read) than the Perl script. I >guess both languages have their own use. Bert, as Bart discussed, there are easier ways to do it. Here was his (although it has been changed somewhat): #!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__ My long version would be: #!perl -w use File::Find; use File::Spec::Functions; use Mac::Files; my $count = 0; my $dir = catdir( FindFolder(kOnSystemDisk, kSystemFolderType), "Eudora Folder", "Attachments Folder" ); my $kill = sub { if (/\.vcf(?: \d+)?$/) { unlink; $count++; } }; find $kill, $dir; print "VCF files killed: $count\n"; __END__ My short version: #!perl -w use File::Find; use File::Spec::Functions; use Mac::Files; find(sub { unlink if /\.vcf(?: \d+)?$/ }, catdir( FindFolder(kOnSystemDisk, kSystemFolderType), "Eudora Folder", "Attachments Folder" )); __END__ And if you make it a droplet, it is even shorter: #!perl -w use File::Find; find(sub { unlink if /\.vcf(?: \d+)?$/ }, @ARGV); __END__ Vicki's version was fine and useful. It was verbose, but had a lot of error checking and seems to be quite robust. It's main flaw was simply that there were plenty of ways to shorten it, either by using existing modules, or by removing stuff (for instance, Vicki's got two ways to put up a folder dialog box, using the newer Mac::Navigation stuff, or the older methods; I avoid that by assuming the path in the script is correct :). She could have also made a call to the AppleScript version of it, so AppleScript could get the path for her. There are plenty of ways to do it. But if you want short, there's not a much shorter way to do it than the above. :-) -- Chris Nandor | pudge@pobox.com | http://pudge.net/ Andover.Net | chris.nandor@andover.net | http://slashcode.com/ # ===== Want to unsubscribe from this list? # ===== Send mail with body "unsubscribe" to macperl-request@macperl.org