bashmkdirmkdirs

Bash create directories recursively without last


How can I ensure that intermidiate components exist? Something like mkdir -p {} but without last component?


Solution

  • Let's say your path is $f

    Just run mkdir -p `dirname $f`