Use this tag for questions about the bash coreutils mkdir command.
Questions tagged [mkdir]
84 questions
225
votes
8 answers
Is there a way to create multiple directories at once with mkdir?
If I wanted to create multiple directories (on the same level) and then feed it a comma seperated list of directory names (or something to that effect)?
BGroat
- 2,425
26
votes
3 answers
Can't make new dir with mkdir
When I run
mkdir ../../bin/Release_Linux/Resources
Im getting an error
$ mkdir ../../bin/Release_Linux/Resources
mkdir: cannot create directory ‘../../bin/Release_Linux/Resources’: No such file or directory
Or just
mkdir…
Slobodan Vidovic
- 427
20
votes
4 answers
Overwrite an existing directory?
I have a directory name foo located in ~/Desktop. Suppose I want to create a directory from a terminal with same name and in the same location. When I tried mkdir it gave an error:
mkdir: cannot create directory `/home/nux/Desktop/foo': File…
nux
- 39,152
18
votes
4 answers
mkdir with date name?
In Linux shell, am I able to create a directory but the name would be a string returned from another program? And if I am able, how to?
In particular I am asked to create a new directory in my Home, and its name would be the minute on my computer's…
Mr T
- 333
13
votes
4 answers
How can I have mkdir cd into the newly-created directory?
Frequently, I type these commands in bash:
mkdir something
cd something
I almost never do this:
mkdir something
ls # something in the current directory, not ./something/
And never this:
mkdir something something2
How can I have mkdir cd into the…
user621107
10
votes
2 answers
Why does mkdir fail (no such file or directory) in a script with BIN_DIR="~/bin/"?
Why does the mkdir command fail with: "No such file or directory"?
#!/bin/bash
set -e
BIN_DIR="~/bin/"
if [ ! -d "$BIN_DIR" ]; then
mkdir "$BIN_DIR"
fi
Hendré
- 779
10
votes
5 answers
Create a folder "Photo" inside all directories recursively
I have a bunch of folders and I want to loop over all those folders and in each folder create another folder named "Photo"
F1
--F11
----F111
----F112
--F12
I want to…
OOzy Pal
- 243
8
votes
4 answers
Bash script to create a directory
I'm messing around with scripting, I am able to create a script which when run prompts me for a name for a new dir, creates it then creates several files, echoes lines out, then deletes it all.
What I would like to do is morph it slightly so it…
SimplySimplified
- 400
8
votes
2 answers
Create the directory structure using mkdir and touch
I am learning Unix online and i came across this question to create a hierarchical structure. I have created the directories using mkdir command but I am stuck while creating the files inside directory.
My command for creating directories is
mkdir…
Neeraj gupta
- 81
8
votes
1 answer
mkdir says that file exists when it doesn't
When I run
mkdir ~/.ipython/extensions/
I get
mkdir: cannot create directory ‘/home/droudy/.ipython/extensions/’: File exists
However when I navigate to /home/droudy, there is no .ipython folder or anything resembling that
Mike. E
- 91
8
votes
2 answers
I can't update any packages nor can upgrade and all this started when I tried to install flashplugin which popup after I tried to upgrade last time
sudo apt-get update
sudo: unable to mkdir /var/lib/sudo: No such file or directory
[sudo] password for md:
E: List directory /var/lib/apt/lists/partial is missing. - Acquire (2: No such file or directory)
E: List of files can't be created as…
Md Taufique
- 81
7
votes
2 answers
rsync throwing mkdir: cannot create directory ‘/data/dir_1/dir_2/dir_3/’: No such file or directory
I mounted a disk at /data. This is empty at the moment.
I need rsync to perform mkdir -p than mkdir as the file I needs to be at at level 4 i.e. /data/dir_1/dir_2/dir_3/filename when dir_1, dir_2 and dir_3 doesn't exists.
If I create the needed…
dragosrsupercool
- 271
7
votes
2 answers
Creating a new subdirectory in multiple existing directories
I am trying to figure out an elegant way to create a new subdirectory in a series of existing directories.
I have 15 already created directories called Week1 through Week15. Within those directories, I'd like to create a new directory called…
Justin
- 2,151
- 7
- 29
- 32
6
votes
1 answer
Missing Downloads folder
I'm using Ubuntu 20.04 LTS. Suddenly today, my Downloads folder went missing. After googling the problem, I used mkdir to create a new Downloads folder. It was created successfully, but the files inside it are missing.
When I run:
locate…
Codess
- 61
5
votes
4 answers
How can I recursively make a directory in the last directories using the command line?
Let's say that I have the following directory structure where the name of the directories does not matter:
currentDir/
Dir1
Dir1
Dir1 *
Dir2 *
Dir3 *
Dir2
Dir1 *
Dir2
Dir1*
Dir3*
Is there a…
kingcobra1986
- 431
- 4
- 10