|<<>>|219 of 221 Show listMobile Mode

Removing illegal filenames in NT/2000

Published by marco on

Updated by marco on

I thought it was a shame that the guy was laughing at what sad bastards we are that we can’t even clean up his mess (for 3 months).

For future reference, here’s how you do it (only works in Windows NT/2000, for Windows 95, 98, use a DOS utility like ‘elim’):

dir /x

The /x switch shows short and long file names. All of the illegal folders had legible short file names. The first one was ~0200, where 20 is actually hexadecimal for 32, which is ‘space’ in ASCII.

Once you know the folder name, you can delete it using the fully-qualified UNC path name. There’s a special, secret syntax for specifying a folder on a fixed hard drive in UNC:


Update: XP seems to use a ? intead of a . as the magic character.

Presumably, you can map a share to the drive and delete using that name as well, but this syntax gets around making a share.

Finally, delete the file using Del or folder using Rd:

del \.\\Drive:\Path\File

rd /S \.\\Drive:\Path

The /S switch will remove that folder and all subfolders and files.

So now you know…and knowing is half the battle.

Go Joe!