How do I create a directory with a trailing space?
To create a directory in Windows with a trailing space character, bring up a command prompt and enter the following:
md "\\?\C:\mydirectory "
The directory must be an absolute (not relative) directory and must be prefixed with \\?\
Similarly you can delete the directory with the rd command
rd "\\?\C:\mydirectory "
but the directory must be empty before deleting it with this command.
Please note that creating a file not supported by Windows can create a situation where you may be unable to delete it by normal means.
Boot into a linux install or live cd, then run this command
mkdir "<mountpoint>/dirname"
You will need the quotation marks.
See this for how to delete
cygwin can
$ mkdir 'abcde'
$ mkdir 'abcde '
$ mkdir 'abcde '
$ ls -l
total 0
drwxr-xr-x+ 1 user None 0 May 15 17:11 abcde
drwxr-xr-x+ 1 user None 0 May 15 17:11 abcde
drwxr-xr-x+ 1 user None 0 May 15 17:11 abcde
ok it clearly worked since we have 3 distinct directories, but let's try to get some kind of further proof
$ echo * | xxd
0000000: 6162 6364 6520 6162 6364 6520 2061 6263 abcde abcde abc
0000010: 6465 2020 0a de .
6162 6364 65 20<---- that's the dir abcde, and echo * put a space in after as there is another item it lists.
6162 6364 6520 20 <-- that's the dir 'abcde ', and echo * displayed it with a space in as there is another item it lists
61 62636465 2020 0a <-- that's the dir 'abcde ', and echo * displayed it followed by new line(0a)
Another
ls offers some formatting options like verical and others e.g. with commas
--format=WORD
across -x, commas -m, horizontal -x, long -l, single-column -1,
verbose -l, vertical -C
--
$ ls -m
abcde, abcde , abcde
Notice the space before the comma that is because the space is in the filename. The ', ' is formatting. But ' ,' shows the space is in the filename.
$ ls -m | xxd
0000000: 6162 6364 652c 2061 6263 6465 202c 2061 abcde, abcde , a
0000010: 6263 6465 2020 0a bcde .
--
a very clear demonstration without needing to look at any hex to verify, is-
$ mkdir 'abcde '
$ mkdir z
$ ls -m
abcde, abcde , abcde , abcde , z
$
Another way, as Mafu mentions in comment, is Mingw which has an Msys package you can install in the ming mackage manager, and msys installs many commands to C:\MinGW\msys\1.0\bin>
e.g. mkdir.exe, and has a bash.exe too