Comparing file paths

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • AmaraEmerson
    New Member
    • Nov 2007
    • 5

    Comparing file paths

    Hi, I'm using C# with .NET 2.0.

    I've got some code that searches for files in a specific directory, however pending some changes I could have the situation where a file exists in the list of found files multiple times. The filenames may not be exactly the same, but I want to know if there is a way of determining whether or not two paths actually point to the same file.

    I can't compare strings, because of the possibility of capitalisation of characters in different places.

    Thanks,
    Amara
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    string comparison can be with disregarding capitalization using.
    And what do you mean different paths pointing to the same file?

    Do you mean like:
    "C:\myfile. txt"
    and
    "\myfile.tx t"


    If you create a FileInfo object for all of your strings, you can use the full path (absolute path?) to compare if the locations given point to the same file.

    Comment

    Working...