Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

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.

share|improve this answer
    
Perhaps you'd need to fix your PATH variable? –  Lie Ryan Feb 25 '13 at 6:51
    
@Lie Ryan But if it was path, then why did which mkdir show the one I want? –  WilliamKF Feb 25 '13 at 12:37
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.