Questions tagged [mkdir]
158 questions
559
votes
4 answers
recursive mkdir
Is there a linux command that I'm overlooking that makes it possible to do something along the lines of:
(pseudo)
$ mkdir -R foo/bar/zoo/andsoforth
Or is there no alternative but to make the directories one at a time?
Dr.Dredel
189
votes
2 answers
How to create nested directory in a single command?
Apparently, it's not possible to create a nested directory in a single command?
$ sudo mkdir x/y/z
mkdir: cannot create directory 'x/y/z': No such file or directory

BaltoStar
- 2,371
43
votes
4 answers
Is mkdir -p totally safe when creating folder already exists
Say I have a folder:
./folder/
Inside it there are many files and even sub-directories.
When I execute:
mkdir -p folder
I won't see any errors even warnings.
So just want to confirm, is there anything lost or changed in result of this command?

AGamePlayer
- 7,605
27
votes
3 answers
Creating multiple nested directories with one command
How can I create multiple nested directories in one command?
mkdir -p /just/one/dir
But I need to create multiple different nested directories...

user3142695
- 1,599
10
votes
5 answers
Create the same subfolders in another folder
I have a directory foo with subdirectories. I wish to create the same subdirectories names in another directory without copying their content. How do I do this?
Is there a way to get ls output as a brace expansion list?

havakok
- 237
4
votes
3 answers
What is the fastest way to create a list of directories specified in a file?
I have a text file, "foo.txt", that specifies a directory in each line:
data/bar/foo
data/bar/foo/chum
data/bar/chum/foo
...
There could be millions of directories and subdirectories
What is the quickest way to create all the directories in bulk,…

Kaizer Sozay
- 739
1
vote
2 answers
Can't create included directory
I'd like to create a new directory that looks like /dir1/dir2/dir3/dir4 but I can't.
If I create the directories one by one from the parent and new parent directories, everything works:
lm@debian:~$ sudo mkdir -v…

ant
- 29
- 4
1
vote
2 answers
When does `mkdir -p /path/to/dir` exit with nonzero status?
mkdir -p /path/to/something
when does the above command exit with nonzero exit status?
Does it happen, if and only if /path/to/something doesn't exist as any file (or as a directory?) before running the command and the command fails to create it…

Tim
- 101,790
0
votes
1 answer
mkdir error: no such file or directory
on a linux machine running CENTOS v 7.8.2003 I am in a directory Neutrinos
I now do
mkdir /pionloop/
this works. I then go to into this new directory pionloop and do
mkdir /E_0.3
and this works as well. I thus have as a result a directory…
-1
votes
1 answer
Where is /tmp/myname located?
When using the following, I understand that I make a directory inside a directory:
mkdir /tmp/myname
but where is it located?
How can I see its parent folder?

axcelenator
- 101