Search code examples
mkdir

mkdir cannot create a particular directory name


mkdir cannot create a folder named "con", but can create any other name. Only happens on a USB drive, in any location on it -- even a freshly created directory. This is completely mysterious to me... I'm trying to backup a library and so it's not easy to just use another name. Example below shows mkdir failing for con and successful for conn.

john@john-desktop:/media/john/Master/exp$ ls -lat
total 4
drwxrwxrwx 1 john john 4096 Jan 21 13:55 ..
drwxrwxrwx 1 john john    0 Jan 21 13:55 .
john@john-desktop:/media/john/Master/exp$ mkdir con
mkdir: cannot create directory ‘con’: Invalid argument
john@john-desktop:/media/john/Master/exp$ mkdir conn
john@john-desktop:/media/john/Master/exp$ ls -lat
total 4
drwxrwxrwx 1 john john  144 Jan 21 13:56 .
drwxrwxrwx 1 john john    0 Jan 21 13:56 conn
drwxrwxrwx 1 john john 4096 Jan 21 13:55 ..
john@john-desktop:/media/john/Master/exp$ which mkdir
/bin/mkdir

Solution

  • CON is a reserved name (originated with MS-DOS) it was short for console which was the original text based output screen. Others are PRN, AUX, NUL, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, and LPT9