in reply to Re: File::Find question
in thread File::Find question
One of my first memories with Perl is reading about find2perl. I had no idea that you could translate shell to perl so easily. Anyway, using find2perl is very easy and demonstrates how to use File::Find.
negativespace.net - all things inbetween.
(mostly copied and pasted into the shell) which prints a complete File::Find based Perl script ready to run. It's a little verbose, so I've removed some of the less important lines for the sake of clarity.[michael]$ find2perl /path/to/directory -name '*.b' -exec rm {} \;
--#! /usr/bin/perl -w use strict; use File::Find (); sub wanted { /^.*\.b\z/s && (unlink($_) || warn "$name: $!\n"); } # Traverse desired filesystems File::Find::find({wanted => \&wanted}, '/path/to/directory'); exit;
negativespace.net - all things inbetween.
|
---|
In Section
Seekers of Perl Wisdom