Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [mkdir]

The tag has no usage guidance.

3
votes
1answer
48 views

Is mkdir -p safe to parallelize?

I'm writing Makefile rules like this: out/%.x: ... mkdir -p $(@D)/ ... I intend to parallelize this Makefile (-j), which will trigger many mkdir -p's to simultaneously. Is this safe? Or do ...
0
votes
1answer
42 views

Why mkdir with ssh doesn't want create longname dir? [duplicate]

Two slackware 14.2 systems,ssh is 7.9p1. On local system mkdir -p -v "I want to create long dir name with spaces" mkdir: directory 'I want to create long dir name with spaces' created And is OK On ...
2
votes
2answers
60 views

Is it possible to detect file or folder creation/deletion in real time?

I want to monitor file or folder creation/deletion instantaneously, is it possible? EDIT:I am using Ubuntu 16.04
-2
votes
1answer
236 views

Mkdir and Insmod - File Exists error

Any ideas what im doing wrong? mkdir /mnt/zmg mount -t cifs -o username=Administrator,password=*****,domain=Provisorio,noserverino //10.20.30.1/zmg /mnt/zmg insmod /mnt/zmg/tntfs.ko Heres a print of ...
3
votes
2answers
181 views

How do I specify a path to an executable for a systemd unit file on nix?

I'm trying to write a systemd unit file. How do I specify the path to an executable? How can I determine what to use? In this specific case I'm trying to use mkdir. ExecStartPre = "/bin/mkdir -p %h/...
1
vote
1answer
172 views

mkdir -p returns error if exists

Raspbian Stretch Lite: $ mkdir --help Usage: mkdir [OPTION]... DIRECTORY... Create the DIRECTORY(ies), if they do not already exist. Mandatory arguments to long options are mandatory for short ...
1
vote
2answers
96 views

How to create multiple directories in Ranger?

As in the equivalent of mkdir dir1 dir2 when running in bash. This creates two separate directories, dir1 and dir2. If you run :mkdir dir1 dir2 in ranger, it simply creates a directory called 'dir1 ...
0
votes
1answer
53 views

Trying to remove current directory using rmdir

I created a directory dir at Desktop and then i keyed in cd dir so as to make dir as my current directory and then i typed in the terminal rmdir /home/user_name/Desktop/dir from the dir directory ...
0
votes
3answers
66 views

Create file in subdirectories that doesn't exist (../new_folder/new_folder/new_file.ext)

For now i use this: mkdir -p a/b/c/d/e; touch a/b/c/d/e/file.abc; Is there more efficient ways?
0
votes
2answers
230 views

Single “mkdir” command to make a new directory and change to that directory at the same time? [duplicate]

Quick question: Is it possible to use "mkdir" to make a new directory AND change to that directory at the same time using a single 'mkdir' command? Whole question: I have this question: What ...
0
votes
2answers
56 views

Can't remove space from beginning of variable

I am trying to crate a folder with the label and uuid of a media device plugged in as its name, on another flash drive which I am using to log. I have the following code: LOGDEVICELABEL=...
1
vote
2answers
235 views

Is there a programmatical difference between directories created with mktemp -d or mkdir?

I try to understand Stephen Kitt's answer to this question where he created a temporary directory with the following code: #!/bin/bash scripttmp=$(mktemp -d) # Create a temporary directory (these ...
0
votes
1answer
702 views

Loop to create subdirectories in multiple directories

I want to create subdirectories into each of directories below. I used the following loop: #! bash /# dir m3z m3t m3t2 m3g m3g2 m3g3 ... n dir for d in m3z m3t m3t2 m3g m3g2 m3g3 ... n ...
0
votes
2answers
3k views

mkdir -p if final target is symlink

Say we have: node_modules/ suman/ and node_modules/suman is a symlink if we do: mkdir -p "$PWD/node_modules/suman" I assume mkdir -p will not overrwrite the symlink? what about if $PWD/...
4
votes
3answers
2k views

Bash wildcard not expanding

I'm trying to make a directory for each file in a directory. mkdir * returns File exists. So I try mkdir *.d and it makes a directory called "*.d". How do I force the wildcard to expand?
1
vote
2answers
74 views

How to create a script to make a structure and sort files by moving them into directories?

I have a bunch of files which all have a first line being a date. All of them start with the same first 2 letters being "ff". I need to create a script which would use that first line in all files and ...
2
votes
4answers
774 views

How to move a folder into itself?

I have a directory foo/ bar.txt baz.yzw wun/ a.out Now, I would like to basically add a directory in between, i.e. I would like to make it foo/ var1/ bar.txt baz.yzw ...
0
votes
2answers
478 views

When does `mkdir -p /path/to/dir` exist 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 ...
0
votes
1answer
125 views

Solaris 9 Fail to mkdir - no permission

In solaris 9 (5.9) I fail to mkdir with user builder, the user exist in the group defined as owner for that path. bash-2.05$ groups builder other root sys bash-2.05$ and this is the file ...
3
votes
1answer
239 views

How to make autoconf use “install” instead of “mkdir -p”?

When I run sudo make install on a compiled package from the GNU archive, it uses mkdir -p to create the destination directories. I'd prefer it to use mkdir -p -m 0755 or install -d -m 0755 instead in ...
2
votes
3answers
111 views

Moving files to directories named after the first 6 digits in the file name

I've got thousands of raw photos (.nef) and relative settings (same filename but .xmp extension) in a single directory on a QNAP nas. My goal is to automate the creation of subdirs named like yyyy-mm ...
1
vote
2answers
527 views

Create folders and subfolders from csv/txt file

I have a excel file which i will convert to csv or txt file with following data: ALFA ROMEO > 147 > Scheinwerferblenden ALFA ROMEO > 156 > Scheinwerferblenden ALFA ROMEO > 156 > ...
1
vote
2answers
173 views

How to make multiple directories and move multiple files

As an example, I have a directory with multiple files in this general format: dir1/identifier1_desiredName1.m dir1/identifier1_desiredName2 dir1/identifier1_desiredName3.m dir1/...
-2
votes
2answers
2k views

Bash command to create a folder and move specific files into it

I am trying to achieve this using bash I have a directory of files, a sample to get the picture is below: January 2010 MA - C3 Edexcel.pdf January 2010 MS - C3 Edexcel.pdf January 2010 QP - C3 ...
0
votes
1answer
51 views

mkdir -p dir with braces created wrongly

I executed the following code in Ubuntu server 16.04 xenial: mkdir -p /root/backups/{db, dirs} I recall that in another system, it worked like charm creating all 3 dirs: /root/backups/ /root/...
2
votes
1answer
155 views

IBM AIX find src_dir -type d -exec mkdir -p “dst_dir/{}” \; doesn't work

I'm trying to copy directory structure from src_dir to dst_dir. On my CentOS 6.4 Linux Bash this command works fine. [localhost]$ find src_dir src_dir src_dir/dir2 src_dir/dir2/dir4 ...
0
votes
1answer
78 views

loop over file and make dir with 1st columns and and wget using the other columns

I have a file like this with multiple rows- GSE55555 ftp://ftp.ncbi.nlm.nih.gov/geo/series/GSE55nnn/GSE55555/suppl/* ftp://ftp.ncbi.nlm.nih.gov/geo/series/GSE55nnn/GSE55555/matrix/* GSE11111 ftp://...
0
votes
0answers
51 views

Create multiple directories with -p option

Why does this command sudo mkdir -p \ /opt/nginx/conf.d \ /opt/gitlab/config throw the error /opt/gitlab/config: File or directory not found. I'm expecting to create it. Also I used the -p flag.
0
votes
2answers
357 views

mkdir with seq command problem

I need to make 5 directories (name1, name2, name3, name4, name5) by command line using mkdir and seq. If I use: mkdir name{`seq -s , 1 5`} It results in one directory: name{1,2,3,4,5} What ...
0
votes
0answers
747 views

mkdir based on arguments then copy files to that directory

I'm trying to create a simple script that I can run through the Android adb shell to move two specific files to a directory that is named based on the argument provided but haven't been having any ...
0
votes
3answers
140 views

Add a folder in a sequence of folders and rename the other folders

I have x number of folders folder1 folder2 folder3 ...... folder100 What I want to do is; add folder2 reorder So now: folder1 folder2 folder3 ...... folder101 So now, the folder that was folder2 ...
4
votes
2answers
670 views

Sort files in a folder into dated folders

I am trying to organize my webcam picture files into folders otherwise I get thousands of pictures in one folder. I have a script foscam-move.sh (from Create sub-directories and organize files by ...
2
votes
2answers
20k views

Permission denied when I tried to create a folder in root [closed]

Hi I tried to create a folder for ssh key in root with this command: mkdir /root/.ssh && chown -R root:root /root && chmod -R 770 /root and I have permission denied: mkdir: cannot ...
1
vote
3answers
507 views

One liner mkdir with directory naming as days?

How can I create directories named as days of the week (i.e Monday, Tuesday, .... Saturday) inside a directory like /tmp/ in one command only? Like combination of mkdir with date +%A or any other. ...
3
votes
1answer
206 views

how to add a custom option to the mkdir command

I have created lots of directories and I would to make my life lazy and to auto cd into the directory that I made with the option of -g with the result of mkdir -g foo The terminal would be like this:...
2
votes
3answers
9k views

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...
13
votes
1answer
1k views

How many directories can be nested?

I'm curious, how many folders can be nested, and why? Is there a limit? What I mean by nested is when folders are in this structure: folder |_ folder |_ folder |_ folder |...
0
votes
2answers
71 views

Create directory name based on other other directories

I have directories: Foo Fee but I also have some directories with names like: Ipsum - Lorem Dolor - Sit If the directory does not contain a hyphen is should be ignored If the directory does ...
0
votes
2answers
142 views

a script to replace mkdir -p command

I'm writing a script that replaces the mkdir -p command. Here is what I have so far: #!/bin/sh n=1; max=50; while [ "$n" -le "$max" ]; do mkdir "s$n" n='expr "$n" + 1'; done I should be able to ...
0
votes
3answers
2k views

How to create a directory with '/' in unix?

I want to create a directory with name as below A3456/90876/IN AS%90876 JI KOL
1
vote
2answers
4k views

Bash can't run command from script: mkdir command not found [closed]

I have separate scripts for tasks in bash. Here is the broken one: #!/bin/bash PATH=/home/name/ mkdir $PATH cd $PATH && echo "done." exit 0 Today it broke and first time it simply didn't ...
0
votes
1answer
3k views

Sudo mkdir fails due to permission denied error

I've written a script that copies some files from one place to another and since I don't have permissions to the source folder, I tried running it with sudo. The problem is that now the creation of ...
-4
votes
1answer
588 views

Creating 2 directories in a different location

sample_dir2 -- sample_dir |-- admin |-- cambridge | `-- security | |-- annex | `-- parking |-- history.exe |-- markham | |-- annex | |-- building1 | `-- parking `-- stenton |...
1
vote
1answer
392 views

$_ not working with copy and move commands

I face the problem with $_ usage, which $_ special parameter in terminal, And its call the last argument of the previous command. It was not work with cp and mv command in gnome-terminal.It happen ...
0
votes
1answer
192 views

mkdir with brace expansion seems to fail when variables are used [duplicate]

Ubuntu 14.04.5 LTS GNU bash, Version 4.3.11(1)-release (x86_64-pc-linux-gnu) mkdir -vp test{1..3}/{a,b,c} works fine mkdir: created directory 'test1' mkdir: created directory 'test1/a' mkdir: ...
0
votes
1answer
1k views

Creating multiple directories using a parameter in a shell script [duplicate]

I'm trying to make a bash script that would make a series of directories and requesting a parameter of how many directories should be created. $> ./createDir.sh 5 $> ls ex_01 ex_02 ex_03 ...
2
votes
0answers
4k views

mkdir: cannot create directory under /root : Permission denied

And here it is, another permission denied, sorry for that, but I cannot get it running. Let me be a stack user with sudo permissions, so that I can create a folder x by sudo mkdir /root/x. That's ...
1
vote
1answer
1k views

alias to make a new directory and go to it [duplicate]

So here I've created, or at least tried to create an alias for a command that accepts a command-line argument, makes a new directory with that name, and goes to it. alias newfolder='mkdir $2 ; cd "$(...
0
votes
2answers
34 views

Create a subirectory within multiple directories

I have a directory containing several folders with different names, and I need to create a subdirectory in each individual folder. The path for one of the folders looks like this: /Volumes/Server1/...
0
votes
1answer
68 views

How to create a new file which provides filename and its source directory information

I have a directory that contains so many sub directories and files in them. I would like to create a file which provides each file name and it's source directory path information For example: I have ...