@IWishIKnew
The "\\?\" prefix that Disch mentions will allow you to remove your folder. I used the following fragment after my little experiment (see below)
1 2 3 4 5 6 7 8
|
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
int main() {
RemoveDirectory("\\\\?\\C:\\Tmp\\Hello...");
return 0;
}
|
Out of interest, how are you creating the "totoo..." folder in the first place?
When I use CreateDirectory with the path "C:\Tmp\Hello...", I just get a folder called "Hello", as Windows assumes I've given it an empty extension.
Using the "\\?\" prefix allows me to create the folder, but Explorer really hates it (I'm still using Windows XP at home, and I cannot even see inside the folder).
The safest approach would prob. be to escape your program's folder names so the file system doesn't have to deal with any problematic chars. Though you'll need to make sure you only escape the bits you want to, rather than the whole string, so Windows can still understand the folder hierarchy.
While you could invent your own scheme, I suggest you base it on the one used used to escape URLs. That is, all problematic chars are replace with % + the hex version of their ASCII or UTF-8 encoding
http://en.wikipedia.org/wiki/Url_encoding
For a subfolder called "Hello..." in C:\Tmp, that ends up as
"C:\Tmp\Hello%2e%2e%2e" in Explorer.
If you allow the user to use all prohibited chars as part of their subfolder name, then you'll need to handle at least \/:*?"<>| as well as . and % (as it's used to mark the escaped chars). So over applying it to "C:\Tmp\Hello..." would have ended up with a subfolder called "C%3a%5cTmp%5cHello%2e%2e%2e", probably created in your apps own directory, if you have sufficient access rights.
And then your program has to be able to un-escape it, too.
Andy