Sorry for my tardy response.
At the moment I have created a command line utility that allows me to capture a file system catalog from a given path. It then allows searching these captured catalogs an also processing catalogs to find duplicate files and calculating MD5 checksums
of candidate duplicate files.
Given that its a command line tool I use the short form of Drive Letter Colon to mean current directory on drive D: (or other drive letter).
eg. "catutil --scan D:"
This would capture the current directory file system heirarchy on D: and not the root of D:\ as such.
The code takes the parameter being the path to capture a folder heirachy from.
And converts it to a more canonical form - ie to the full path on the device specififed.
public string CanonicalPath(string path)
path = GetFullPath(path);
var volumeRoot = GetDirectoryRoot(path);
path = path + Path.DirectorySeparatorChar;
if (path.EndsWith(Path.DirectorySeparatorChar) && volumeRoot != path)
path = path.TrimEnd(Path.DirectorySeparatorChar.ToCharArray());
path = char.ToUpper(path) + path.Substring(1);
I am not aware of another means to convert a "D:" to a D:\Whatever\Current\Directory\Path\Currently\Is" so was using System.IO.Path.GetFullPath().
When I switched to AlphaFS, this no longer let me find out what the full current directory was on the device.
The work around I use was to create my own GetFullPath that uses System.IO.Path.GetFullPath() for Short Device Letter Colon format strings.
Which hasnt caused me any pain at the moment.
The extension of this to the result of GetDirectoryRoot() return D: without a backslash hasnt got the same meaning as D:\.
Hope this clears things up to the use case.
If something is unclear or if im just missing some obvious point please let me know :).
I like AlphaFS its pretty nice to use, and has some nice convenience methods as well.
Oh btw the I just remembered. I had a hicup with Directory.GetFiles() Method as well, I am not sure its a bug just a surprise for me.
const string name1 = "G-SN750B_02_S13UJ1NQ221583.cde";
const string name2 = "G-SN750B_02_S13UJ1NQ221583.cde-backup-with-hash";
var f1 = File.Create(name1);
var f2 = File.Create(name2);
var files = Directory.GetFiles(".", "*.cde", SearchOption.TopDirectoryOnly);
This code lists both of the files name1, name2 much to my initial surprise.
I have another helper that now hides this and ensure there is no characteres beyond the end of the search Pattern parameter.