Languages
[Edit]
EN

Bash create directory if not exists

2 points
Created by:
Maryamcc
341

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

 

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