3

First I do this:

mkdir firstFolder

Then:

mkdir firstFolder/secondFolder

Here an error occurs. The command line interface returns "incorrect syntax". What is the right syntax?

I am using Bash upon Cmdr in Windows 7.

Giacomo1968
  • 58,727

2 Answers2

2

You think it's Bash but maybe it's not. CMD in Windows has mkdir too but the directory separator is \.

Try

mkdir firstFolder\secondFolder

In Bash the backslash would be interpreted as (unnecessary) escape character, the command would create a directory named firstFoldersecondFolder. If it creates secondFolder inside firstFolder then you're not in Bash.

1

You can use this to create the whole tree in one go and avoid the error:

mkdir -p firstFolder/secondFolder/thirdFolder

The -p parameter is defined as:

-p, --parents     no error if existing, make parent directories as needed

Note: This depends on how close to the Linux standard is implemented mkdir in your environment.

harrymc
  • 498,455