0

I am on linux, and want to create a directory called !? in a flash drive formatted as FAT32. No matter what I try, whether it be GUI or mkdir, I cannot create a directory called !?. However, I can do it in other places, such as my home directory. Why can't I do this on a flash drive??

Blue-Maned Hawk
  • 387
  • 1
  • 4
  • 13

2 Answers2

1

You have to use an escape character before the ! symbol.

In order to make your directory !? you need to write the command as mkdir \!? (with no space between the \ and !) or as mkdir '!?' (single quotes, not double).

Normally, I believe ! is used to reference events. I honestly don't know a whole lot about it. I just know how to make your directory by using the escape character, so the shell knows to interpret that character literally.

u1686_grawity
  • 426,297
  • 64
  • 894
  • 966
DrZoo
  • 10,469
  • 4
  • 42
  • 60
  • 1
    `!` is the "command history" character in bash and similar shells – it lets you run a recent command based on its name or first word, or re-use a previous command's parameters. However, it should not affect GUI programs in any way, as they do not make their operations through an interactive shell. – u1686_grawity Sep 25 '19 at 04:40
  • Both of those only work on my main drive's filesystem, not on the flash drive. – Blue-Maned Hawk Sep 27 '19 at 02:51
1

In this table on Wikipedia there is "allowable characters in directory entries" column. The entry for FAT32 states:

[…] except NUL, " * / : < > ? \ |

The chosen name !? contains ? which is not allowed. Choose another name or another filesystem. Note while ? is technically possible in NTFS, it may be problematic in Windows, so NTFS is not necessarily a good choice if you need this particular directory name.

Kamil Maciorowski
  • 69,815
  • 22
  • 136
  • 202