Hey!!! This man is really hot, he must be the man of the hour with more power. thanks .... and just for this last one modfication to the obove:
"Now I need to read in the extension from the command line" John how long are you into perl? Cheers Bruce >>> John Edwards <[EMAIL PROTECTED]> 02/13/02 05:32PM >>> OK. Using the code from before #!/usr/local/bin/perl -w # first example... use strict; # declarations... my @files = `ls -F`; my %fil; my $extension = "jpg"; foreach ( @files ){ # Use the special $_ var to store each iteration next if /private/i; # Stop this iteration if the value of $_ contains private, case insensitive chomp; # Chomp defaults to $_ if not specified. # This line isn't needed $fil{$f} = 0; # # if we match the extension... if(/\.$extension$/){ $fil{$_} = $_; } # if this IS a directory - Surely you only want your list of files to consist of file, not dirs?? - remove the entry from the %fil hash # if(-d $_) delete( $fil{$_} ); As we no longer create the hash pair unless the file matches the extension this isn't needed either } foreach my $key (sort keys %fil) { print "$key\n"; } Although, unless you do something more with the hash, you may be better off storing the values in an array like this.... #!/usr/local/bin/perl -w # first example... use strict; # declarations... my @files = `ls -F`; my @jpegs; my $extension = "jpg"; foreach ( @files ){ next if /private/i; chomp; if(/\.$extension$/){ push(@jpegs, $_); } } foreach (@jpegs) { print "$_\n"; } HTH John -----Original Message----- From: Bruce Ambraal [mailto:[EMAIL PROTECTED]] Sent: 13 February 2002 15:30 To: [EMAIL PROTECTED] Subject: RE: finding .jpg or any .extention file Hi Jonh I want to recursively find files in a directory that end in .jpg. Would you assist with this one? Cheers Bruce --------------------------Confidentiality--------------------------. This E-mail is confidential. It should not be read, copied, disclosed or used by any person other than the intended recipient. Unauthorised use, disclosure or copying by whatever medium is strictly prohibited and may be unlawful. If you have received this E-mail in error please contact the sender immediately and delete the E-mail from your system. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]