1

I'm using Interix on Windows for Unix compatibility and am finding the -p argument to mkdir not behaving as I expect:

> which mkdir
C:\SFU\bin\mkdir

> mkdir -p c:\Program Files\
A subdirectory or file -p already exists.
Error occurred while processing: -p.

The SUA man page for mkdir states in part:

NAME
     mkdir - make directories

SYNOPSIS
     mkdir [-p] [-m mode] directory_name [...]

DESCRIPTION
     The mkdir utility creates the directories named as operands, in the order
     specified, using mode rwxrwxrwx (0777) as modified by the current
     umask(2).

     -p      Create intermediate directories as required.  If this option is
             not specified, the full path prefix of each operand must already
             exist.  Intermediate directories are created with permission bits
             of rwxrwxrwx (0777) as modified by the current umask, plus write
             and search permission for the owner.  Do not consider it an error
             if the argument directory already exists.

Why am I getting error about existing directory even though I passed -p? It seems the -p is not recognized as a flag and instead it is making a directory named -p. How do you pass the -p argument?

WilliamKF
  • 8,058

1 Answers1

0

The windows mkdir was being picked up instead of the Interix one. I avoid the issue by giving full path to Interix's mkdir location. This was needed even though which mkdir gave the Interix one.

WilliamKF
  • 8,058