Hi Uri, uri> that still isn't clear to me. is the @ARGV value to be scanned or uri> skipped? you need to be very clear when you specify this stuff.
The @ARGV value is to be scanned for its sub-directories but excluding @ARGV itself ... the File::Find gives all the listing and including the @ARGV ... Your hacked pseudo-code works fine and does what am looking for ... Thanks ... On Mon, Jun 7, 2010 at 6:45 PM, Uri Guttman <u...@stemsystems.com> wrote: > >>>>> "np" == newbie01 perl <newbie01.p...@gmail.com> writes: > > np> Hi Uri, > uri> first off please edit the quoted part of posts. only keep the parts > you > uri> are commenting or asking about. > > np> - thanks, will try to do that every time from now on ... btw, how > np> are you editing yours, manually ... you look like you are doing > np> your editing of the quote programmatically .. > > emacs with gnus and supercite. many decent text editors and mailers > support indented quoting of emails. > > np> - Oracle creates core dumps as directories. The script is supposed > np> to check the core dump directory and search for old core dump > np> directories and remove them. The core dump directory is the > np> argument provided when the script was invoked, i.e., > np> ./remove_coredumps.pl /u01/oradump/cdump, /u01/oradump/cdump is > np> the core dump directory to search. > > uri> but a simple answer is to just put a test inside the find sub so you > uri> don't push a file if it matches what is passed in @ARGV. > > np> - Yep, this is the one that am thinking about ... just thought it > np> will be "safer" to use File::Find::Rule as an exact match to strip > np> off the argument before the array is processed in the for loop > np> ... The script is to search the core dump directory but exclude > np> that directory, kinda like doing a grep for ^/ u01/oradump/cdump, > np> /u01/oradump/cdump$/ and exclude that from the directory to > np> remove. > > that still isn't clear to me. is the @ARGV value to be scanned or > skipped? you need to be very clear when you specify this stuff. > > > you can just do what i said. inside the find sub add a simple test of > the file name and the @ARGV value (i don't know what kind of test you > want). then skip the push command if that passes/fails. something like > this (and i don't know the file::find vars off the top of my head so > this is hacked pseudo code with the file in $_) > > my $skip_regex = shift @ARGV or die "no args were passed in" > > sub my_find { > > # skip a dir matching @ARGV value > > return if $dir =~ /$skip_regex/ ; > > # keep files with the cdump suffix > > push @dump_files, $_ if /cdump$/ ; > > > and you still quoted my entire email below. just keep the parts you need > for context and put your comments below. you did fine at the top but > there is no need for a full copy of my email. > > uri > > -- > Uri Guttman ------ u...@stemsystems.com -------- http://www.sysarch.com-- > ----- Perl Code Review , Architecture, Development, Training, Support > ------ > --------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com--------- >