How to create a complete directory structure with a single command?
By this question I mean, if I wanted to create a directory structure like below in one go using a command.
/abcd/efgh/ijkl/mnop/qrst/uvwx/yz/
then what command shall I use?
How to create a complete directory structure with a single command?
By this question I mean, if I wanted to create a directory structure like below in one go using a command.
/abcd/efgh/ijkl/mnop/qrst/uvwx/yz/
then what command shall I use?
mkdir -p /abcd/efgh/ijkl/mnop/qrst/uvwx/yz/
mkdir
is "make directory"
The -p option creates the parent directories if they do not already exist.
Here is the answer to the question,below command will do the job you want in just the way you want :) This can be done with mkdir (make directory command) as shown below:
root@test:~# sudo mkdir -p /abcd/efgh/ijkl/mnop/qrst/uvwx/yz/
root@test:~#
If you want it to show you the directories it created while it is working then use verbose with it as shown below:
root@test:~# sudo mkdir -pv /abcd/efgh/ijkl/mnop/qrst/uvwx/yz/
mkdir: created directory `/abcd'
mkdir: created directory `/abcd/efgh'
mkdir: created directory `/abcd/efgh/ijkl'
mkdir: created directory `/abcd/efgh/ijkl/mnop'
mkdir: created directory `/abcd/efgh/ijkl/mnop/qrst'
mkdir: created directory `/abcd/efgh/ijkl/mnop/qrst/uvwx'
mkdir: created directory `/abcd/efgh/ijkl/mnop/qrst/uvwx/yz/'
root@test:~#
Enjoy!! :)