Fortran 90 create directory syntax error

2020-05-07 10:05发布

问题:

I thought I found out how to create directories in this post

Creating directory with name containing real number in FORTRAN

But when I tried to create a directory in my Fortran 90 program

call system('mkdir -p out/test')

or

call system('mkdir out/test')

I don't get any compilation errors or warnings, but I get the following runtime error:

The syntax of the command is incorrect.

Any idea what is wrong? Any help is greatly appreciated!

回答1:

From the error message I assume you are using Windows. Then, you have to use \ as a folder separator:

call system('mkdir out\test')

Also, -p (the Unix option to create parent folders) is invalid for Windows (and also not required).