in reply to Re^3: Printing files that has two different extensions in a given directory
in thread Printing all the files that have both ".rtf" and ".ftp" by searching recursively in a given directory

Thanks,this is exactly what i want,but the thing is I want to print the absolute path ,instead of just the file names.Can you please advise? </p?

  • Comment on Re^4: Printing files that has two different extensions in a given directory

Replies are listed 'Best First'.
Re^5: Printing files that has two different extensions in a given directory
by ikegami (Patriarch) on Apr 12, 2011 at 22:40 UTC

    hum. Earlier, you said "I only want to print the names of files" (Upd: ... but I see you meant you meant something quite different. )

    use strict; use warnings; use File::Find::Rule qw( ); use File::Basename qw( basename ); my %files; for ( File::Find::Rule ->file() ->name('*.rtf', '*.ftp') ->in('.') ) { my ($name, $ext) = basename($_) =~ /^(.*)\.(.*)\z/; push @{ $files{$name}{$ext} }, $_; } for my $name (%files) { if ($files{$name}{rtf} && $files{$name}{ftp}) { print "$_\n" for @{ $files{$name}{rtf} }, @{ $files{$name}{ftp} +}; } }

    This can probably be done cleaner.