14

I named a folder " ", the symbol for a space.

In Linux you can create folders with just a space. Now that I've switched over to Windows, I can't move the folder that has the folder named " " in it. Nor can I move anything in the folder itself, or rename the folder.

I have tried Unlocker 1.9.2, and it didn't work either. It asked me to perform the operation at reboot, I agreed and it didn't do anything.

How can I rename the folder named " " from within Windows?

11
  • 11
    Switch back to linux and rename it? Dec 30, 2013 at 15:25
  • 1
    That is a workaround, not a solution. Though it may well be the fastest way if you got a liveCD lying around.
    – Hennes
    Dec 30, 2013 at 15:27
  • no, i don't have a live CD.
    – user285603
    Dec 30, 2013 at 15:33
  • 1
    I am not sure it is possible. http://msdn.microsoft.com/en-us/library/aa365247%28VS.85%29.aspx states "Do not end a file or directory name with a space or a period. Although the underlying file system may support such names, the Windows shell and user interface does not." A single space also counts as ending with a space. :(
    – Hennes
    Dec 30, 2013 at 15:34
  • 2
    Install Cygwin. Dec 30, 2013 at 17:06

6 Answers 6

17

It's not in fact true that this is impossible on Windows. It is possible to fix this with the SFUA Utilities on the Subsystem for UNIX-Based Applications on Windows 7 (Ultimate edition). I just did so:

JdeBP ~/Desktop %mkdir ' '
JdeBP ~/Desktop %ls -ldQ ' '
drwxr-xr-x  1 JdeBP  None  0 Dec 30 16:14 " "
JdeBP ~/Desktop %mv ' ' space
JdeBP ~/Desktop %rmdir space
JdeBP ~/Desktop %

Instead of using rmdir I could have just deleted the space folder from the desktop using Windows Explorer; or done anything else, including accessing its contents (had it had any).

The problem is not Windows NT itself. It's the Win32 subsystem rules for filenames. The POSIX subsysem doesn't impose the same rules.

6
  • but no way of renaming the folder?
    – user285603
    Dec 30, 2013 at 16:50
  • 3
    The above shows the folder being renamed.
    – JdeBP
    Dec 30, 2013 at 16:54
  • 2
    Just to clarify it a way more: The unix way of renaming a file is to m o v e it to a new name.
    – Hennes
    Dec 30, 2013 at 17:23
  • Oh...yeah, tried to use it... WAY too complicated for me.
    – user285603
    Dec 30, 2013 at 17:50
  • 7
    @user285603 you just need to download SUA, install it and then run the commands provided here. That's not that hard! What were you expecting? A magic word?
    – terdon
    Dec 30, 2013 at 18:57
8

You could try:
Rename the folder using 7-Zip


Tested on Win7 x64 with 7-Zip portable version

Steps to Reproduce:

  1. Create folder (F7) with default name: "New Folder"

  2. Rename "New Folder" to " "

  3. Rename " " back to "New Folder"


This answer is similar to this one which solve "How to delete a folder containing trailing spaces": https://superuser.com/a/366583/163596

6

The best bet for you to use a live cd of Linux and then rename the folder and then use it windows. AFAIK and others have stated here there is no way to do this using Windows. If I could find a way I would edit my post.

2
  • 3
    Nitpick mode: "There is no way to do this using Windows". No. There is no way to do this using the regular windows API. A windows program which uses its own interface to the filesystem rather than the win32 API can still do this.
    – Hennes
    Dec 30, 2013 at 16:45
  • Shades of Norton Utilities from Dos days, edit the filesystem on disk by hand. Is it a FAT filesystem (presumably not EXT2-4) ? You should just be able to overstrike it on the disk with a suitable editor.
    – mckenzm
    Jan 19, 2016 at 1:43
2

As noted, the problem is the Windows user interfaces, not the Windows filesystem.

If you can write in almost any programming language, and that language has a library function which will let you manipulate the filesystem, you should be able to quickly write a minimal program that will let you rename this beast.

Or, as others have noted, you can try using the wildcard approach. ? is a single-character wildcard; if you don't have any other files or directories with one-character names you could try "ren ? foo" and see whether that's enough to sneak past the special-case checks for the space character.

5
  • How does this work with other reserved or special characters such as < (less than) > (greater than) : (colon) " (double quote) / (forward slash) \ (backslash) | (vertical bar or pipe) ? (question mark) * (asterisk)?
    – Motivated
    Jan 6, 2016 at 5:10
  • There are ways of escaping almost any printing character, in almost any string entry scheme. (Sometimes nonprinting ones too.) Read the fine manual... Or, as I said, wildcard-match them.
    – keshlam
    Jan 6, 2016 at 6:31
  • This assumes that you have the means of escaping any character since the challenge i have come across is with third-party applications. For examples particular backup or synchronization apps especially if you are transmitting files from one filesystem to another. How do you address these?
    – Motivated
    Jan 6, 2016 at 8:08
  • If an application can't handle a legal filename, that's an issue with that particular application. Contact the user community, the authors and/or the vendors, and ask them whether this is a bug that they're fixing (and if there's a workaround), a design decision (in which case you rename the file or use another app, your choice), or if you just didn't understand how to do it in this app. Same as with anything else you're having trouble with. Same as was done in this very question. The OS is doing the right thing.
    – keshlam
    Jan 6, 2016 at 13:25
  • What do you mean that the OS is doing the right thing?
    – Motivated
    Jan 6, 2016 at 22:43
2

I am running XP so unsure of the specific nuances of Windows 7, but using Cygwin I was able to create a folder named " " containing a few random files, then using the mv command rename the folder and keep its contents.

cd the/path/of/the/parent/folder

mv " " newfoldername

0

This is definitely untested, but out of curiosity it may be a solution:

  1. Move any other folders that are in the parent folder of your " " folder

  2. Fire up PowerShell, and navigate to the parent folder.

  3. Run Remove-Item .\*

13
  • From the OP: "I can't move anything in the folder."
    – Hennes
    Dec 30, 2013 at 15:50
  • @Hennes I took that as a "I can't move anything in the folder that is named a space", not as "I can't move anything in the parent folder".
    – Thor
    Dec 30, 2013 at 15:50
  • I could be wrong. Waiting for the OP to add more information on testing things (and really curious how to handle this kind of thing).
    – Hennes
    Dec 30, 2013 at 15:51
  • @Hennes We'll just have to wait and see!
    – Thor
    Dec 30, 2013 at 15:54
  • 1
    The OP wants to rename it, not remove it, presumably because he wants to keep things in it...
    – Izkata
    Dec 30, 2013 at 20:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .