Languages
[Edit]
EN

Bash create directory if not exists

2 points
Created by:
Maryamcc
541

Quick solution: 

mkdir -p /root/some_dir/some_dir_2

# NOTES:

# 1 - it will do nothing if all directories already exists
# so we can execute this command two times and no errors will occur

# 2 - it will create all subdirectory if they don't exists
# if some_dir and some_dir_2 doesn't exists this command will create both of them

 

Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join