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

When I run the above script on a directory I get the following output even there are files with same name but with both extensions .rtf and .ftp

$VAR1 = [];

  • Comment on Re^3: Printing all the files that have both ".rtf" and ".ftp" by searching recursively in a given directory
  • Download Code

Replies are listed 'Best First'.
Re^4: Printing all the files that have both ".rtf" and ".ftp" by searching recursively in a given directory
by Anonymous Monk on Apr 12, 2011 at 18:58 UTC

    It seems like the below code is printing the files with .rtf or .ftp files,I want to print files that has both .rtf and .ftp extension.Can someone advise?

    use warnings; use strict; use File::Find::Rule; use Data::Dumper; my @files = File::Find::Rule->file() ->name( '*.rtf', '*.ftp' ) ->in( './' ); print Dumper(\@files);
      Are you saying you have a file named something like "foo.rtf.ftp" or "foo.ftp.rtf"? Just change the name strings to match your bizarre file names:
      use warnings; use strict; use File::Find::Rule; use Data::Dumper; my @files = File::Find::Rule->file() ->name( '*.rtf*.ftp', '*.ftp*.rtf' ) ->in( './' ); print Dumper(\@files);

        I have a file with name foo.rtf and foo.ftp ,I only want to print such files with both extensions