Re: Get the exact case of a folder name

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



There's no need to separately extract the parent directory. The Getfiles function of the directoryinfo object of the FileInfo object returns the filename with the correct capitalization, such as :
fi.Directory.GetFiles(fi.Name)(0).FullName

"Armin Zingler" <az.nospam@xxxxxxxxxx> wrote in message news:uSIB0MRtJHA.528@xxxxxxxxxxxxxxxxxxxxxxx
James Hahn wrote:
You can't directly convert the user input into the actual case of the
file name, but you could use a fileinfo object to determine whether
the file exists, using the name as input by the user. If it exists,
use the full name property of the fileinfo to return the name in a
format with the correct case for the CmdExec.

I've tried several things but the name was never the name in the file
system. I always got the name that I passed into the constructor, i.e. all
lower case even if there are capital letters in the file systme. How did you
achieve to get the name in the file system? I would have to recursively get
the name of the file by retrieving it from the file system entries from it's
_parent_ directory. I've only tried it for the last part of the path, so I
don't have a working solution.

Just curious, because I failed. :-)


Armin


.