Rename/delete Windows (x64) folder with leading and trailing space

The answer from @Ocelot did not work on Windows Server 2008 R2. What did work was:

Open a command, change to the directory and do a "dir /x". You will see the long and the short name of the directory. You can always rename the short version as it does not contain spaces most of the time. So a ren 3839F~1.4_T whatever should be possible.


I just had a similar problem with folder "Monuments - Discography " created in linux. Windows Vista and Windows 7 couldn't recognize this folder as a valid data and when I tried to rename or remove it I got Info message saying that folder does not exist etc. The solution was to explore a dir with 7zip file manager and rename the folder by removing a white space from the end. Simple. Now I can enjoy the music once again :D


Find the item you want renamed in the main window. Then right click the file/folder in the list and click "rename".

You could also select it by clicking it once and press F2.

Edit:

Try this from the commandline:

rename "\\?\c:\<PATH HERE>\[ ]1[ ]" "<NEW FILE NAME>"

or

rename "\\?\c:\<PATH HERE>\ 1 " "<NEW FILE NAME>"

Mind you, the NEW FILE NAME doesn't take the full path, so just use the file's name. PATH HERE is just the path without the file.

Tags:

Windows 7