There seems to be no straighforward way to do this. You cannot compare the file paths because the file path provided may not be canonical. A file can be referred to by various type of path strings, redirections, etc.
I had initially believed that creating two FileInfo instances and comparing them would be the solution, but that does not work apparently. The usual way to do this is to use the Win32 API to compare the File handles using the "GetFileInformationByHandle" method. Keep in mind that this method assumes that you can open both files for reading. An example is posted here: http://goo.gl/KnhIi On Feb 1, 8:00 pm, jtaylor <[email protected]> wrote: > I have two strings that contain file paths. Is there some way to > check if they both point to the same file? The paths could be mapped > drives or UNC paths, and might reference different share names > pointing to the same server folder. Is there some way to check this? > > VS2005 -- You received this message because you are subscribed to the Google Groups "DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/dotnetdevelopment?hl=en?hl=en or visit the group website at http://megasolutions.net
