in reply to Re^4: 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

I purposefully did not introduce the following errors from which your version suffers:

Don't know if it matters to the OP or not.

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

Replies are listed 'Best First'.
Re^6: Printing files that has two different extensions in a given directory
by JavaFan (Canon) on Apr 12, 2011 at 22:12 UTC
    Wait, you have a file system that allows two different files with the same name in a given directory?

      I have a file system that allows two different files with the same name in a given directory tree

      The OP said "foo" should be returned for

      foo.rtf data\foo.ftp

      He didn't say it shouldn't return "foo" for

      foo.rtf data\foo.ftp atad\foo.ftp

      Can this situation happen? Dunno. I chose to support it, and I pointed out that yours doesn't.

      Actually, yours doesn't even work for the case the OP mentioned explicitly, even after one fixes the compilation error.

        That was caused by assuming that your original (pre-fixed) solution was correct. The one that didn't have the basename in it, and used full path names.