Removing a folder (or file) with a space on the End

posted 12 Jun 2011, 04:20 by Tristan Self

Windows can allow a user to create a file or folder with a space at the end that it then cannot manage, to remove it you need to follow this procedure.

You’ll receive an error if you try to remove it.



Find out the 8.3 version of the folder name by opening a command prompt:

DIR /X

20/05/2009  10:58    DIR         7A215~1.23A  7.23A Generic Risk Assessments File

The text in red is the 8.3 filename that we are going to use.

Then remove as follows:

rd 7a215~1.23A
rd /s 7a215~1.23A

The “/s” means it will recursively delete all the files and folders below (use with care.)

The above procedure basically allows you to remove a file that you could otherwise not delete via the Windows GUI, if it has a space at the end of the file/folder name.
Comments