- Forums
- Linux Systems
- How To Make A Directory With All Its Sub Directories With One Command
This Page Contains information about How To Make A Directory With All Its Sub Directories With One Command By wallpaperama in category Linux Systems with 0 Replies. [3062], Last Updated: Sat May 18, 2024
wallpaperama
Tue Apr 14, 2009
0 Comments
898 Visits
ok, lets say im working in linux, and im logged into the shell by using ssh. and i am in my home direcotry called: /home/wallpaperama (for example)
so if im in /home/wallpaperama and i send this command:
mkdir 1 it will create another direcotory: /home/wallpaperama/1
so lets say the goal is to have more child directories like this:
/home/wallpaperama/1/2/3/4/5/6/7
one way to do it is to send each command at one time for example like this:
mkdir /home/wallpaperama/1
mkdir /home/wallpaperama/1/2
mkdir /home/wallpaperama/1/2/3
mkdir /home/wallpaperama/1/2/3/4
mkdir /home/wallpaperama/1/2/3/4/5
mkdir /home/wallpaperama/1/2/3/4/5/6
as you can see i would have to send six differen commands at once to creat all its sub-directories. BUT there is a shortcut my friend, you can do all this with just one command, here it is:
mkdir -p /home/wallpaperama/1/2/3/4/5/6
that command will create all its child and parents directories
hope that helps