Questions tagged [mkdir]
The mkdir tag has no usage guidance.
145
questions
0
votes
1
answer
35
views
How can i create sub directories within a directory? [closed]
I am trying to make a photo organizer with a zsh shell script. But i am having trouble creating sub directories within each main directory(based on date). Currently the script starts from a folder i ...
0
votes
2
answers
66
views
Creating and arranging files into folders based on date and time in file name
I have many files in a folder Main which are named like these:
2021_10_15_23_35_SIP_CDR_pid3894_ins2_thread_1_4718.csv.gz
2021_11_24_21_15_Gi_pid25961_ins2_thread_1_6438.csv.gz ...
0
votes
1
answer
39
views
Why does mkdir messes up special characters (german umlauts)?
I have a system which is set up with Debian. Running the command
mkdir xx_ü
on this system, creates a directory called 'xx_'$'\303\274'. Running the same command on a system that is set up with ...
0
votes
1
answer
33
views
Sorting long list of files into multiple sub directories based on name
I have a group of 1000+ files that are labeled using text and date in a folder /home/dir/dir2/oldspot with below format:
File taken on 01/07/2020 at 23:08 elevation 5 is
aaaaaa-bbbb-cc10dddd-L1-...
1
vote
1
answer
29
views
Setting setuid on `mkdir` without making it as executable
I am setting setuid on mkdir without making it as executable.
chmod u+s /usr/bin/mkdir
chmod u-x /usr/bin/mkdir
[root@rhel-85 /]# ls -l /usr/bin/mkdir
-rwSr-xr-x. 1 root root 84664 Jul 9 2021 /...
0
votes
1
answer
65
views
why when hooking syscalls from the kernel, is the pid of kill, zsh, but the pid of mkdir is mkdir?
I am writing my own rootkit to learn about Linux kernels. I wanted to hook into a syscall and alter the credentials of the current task to be that of roots (i.e.euid=0). I saw you could do this with ...
4
votes
1
answer
405
views
How to create folders using user input for the name and number
The user will be asked 2 variables which will be the name of the folder and the number of folder they want to create. So if a user inputs sea and 3, the output should be: sea, sea2, sea3
read -p "...
3
votes
4
answers
123
views
How create many nested directories and defining the permission to all them in one command?
In Linux the following two commands work as expected:
mkdir -m 555 new_directory
mkdir -p a/b/c
But the following does not work as expected:
mkdir -m 555 -p a/b/c
the 3 directories are created but ...
0
votes
1
answer
27
views
Creating a directory from many variables
I want to create a script that creates a new folder with the name of the first argument in the directory specified as the second argument.
#!/bin/bash -e
## Passing Arguments (fastq data and ...
0
votes
1
answer
402
views
mkdir gives "No space left on device" message but sudo mkdir works [duplicate]
When I try to use mkdir test in /home/, I get mkdir: cannot create directory ‘test’: No space left on device. I've deleted over 1Gb of files and restarted some processes that were using deleted files, ...
0
votes
1
answer
58
views
Using mkdir -p, is it possible to create files within subdirectories using regular expressions? [duplicate]
I am trying to create a file using the mkdir -p command.
Using mkdir -p ~/1/2/3/4, how would I put files (w,x) into /2, and (y,z) into /3 all in a single command?
I know I could use a touch command ...
0
votes
0
answers
418
views
mkdir error, permission denied
i was installed spotify yesterday with snap in kali linux, then i run with snap run spotify and i get error like this :
snap run spotify
WARNING: cgroup v2 is not fully supported yet, proceeding with ...
0
votes
0
answers
61
views
mkdir appending carriage return when creating folders based on variable names [duplicate]
Context
OS: Ubuntu 18.04.6 LTS
Text editor: GNU nano, 2.9.3
In the BASH script below, I'm trying to create directories using mkdir. The name of each directory is determined by a combination of ...
0
votes
1
answer
65
views
mkdir as another user based on configuration file
We have a shared Linux environment where most files are mounted to many machines on a NFSv3 share, which we do not control. Since we only have basic filesystem permissions available (No ACLs), we are ...
2
votes
1
answer
119
views
If the `-p` flag not needed anymore in `mkdir` 9.0?
I can't find any reference of this change of behaviour
$ mkdir --version
mkdir (GNU coreutils) 9.0
Copyright (C) 2021 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <...
0
votes
1
answer
64
views
Permissions Issue creating folder on remote host with Jenkins
I'm having an issue with using Jenkins to create a folder on a remote host.
The remote host in this case is a stock Ubuntu 20.04 AMI EC2 server with the default ubuntu user.
I am connecting with the ...
0
votes
0
answers
37
views
Mounting subdir to a new NFS
I have a directory that is mounted with NFS.
10.159.31.81:/var/lib/phone /var/lib/phone nfs hard,bg,intr,vers=3,noatime 0 0
I want to test my new NFS servers but I don't want to move everything over. ...
0
votes
2
answers
1k
views
LINUX unable to create a directory | mkdir: cannot create directory ‘test_nfs’: Permission denied
I am trying to create a new directory under /mnt but unable to do so.
I have presented a volume through nfs server to client.
-->RPCbind is active.
/mnt$ service rpcbind status
● rpcbind.service - ...
0
votes
1
answer
34
views
copy files from multiple remote machines to local and create directories for remote machines
Have multiple vm machines that am using for studying, and have come up with this script for copying some files from vm's to my local machine:
SG=rohos; date; for i in `cat /etc/hosts | grep "$SG-&...
1
vote
1
answer
129
views
mkdir says folder exists even though it doesn't show with ls -a
Arch linux.
I have a CIFS mount from my NAS that was mounted with full permissions
# line from my fstab
//IP_ADDRESS/path/to/dir /path/to/local/dir cifs uid=my_user,gid=my_group,dir_mode=0777,...
0
votes
2
answers
426
views
How to run a remote script with sudo via ssh without entering password
I would like my script to connect to ssh with password, and once connected it will switch to sudo -s and run the mkdir command
for the moment I manage to connect to ssh without entering the password ...
1
vote
1
answer
1k
views
Synchronizing with rsync outputs error "Invalid argument (22)" for directories with dots and other symbols in their name
I tried to synchronize /dir1 (ext4) and /dir2 (ntfs) using rsync -azP, but got these errors:
rsync: recv_generator: mkdir "dir2/X.Y." failed: Invalid argument (22)
rsync: recv_generator: ...
0
votes
1
answer
85
views
Creating directories inside a directory, from variable values, to redirect output from sed
I am trying to take a file, modify this file by using a value from a for loop (using sed) and redirecting it to a directory that has been created during the same for loop.
Original file > Make ...
-1
votes
1
answer
91
views
Where is /tmp/myname located? [closed]
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?
-2
votes
1
answer
127
views
Move every 500 files in new directory [closed]
I have a directory that contains 10,665 jpeg files.
I want to move 500 files to a new directory, and 500 to the next directory, etc.
The largest files must be moved first:
500-1 contains the 500 ...
0
votes
2
answers
140
views
Directory creation using brace expansion
mkdir Public/1 2 3 ----- This line creates folder 1 in the Public folder and creates folders named 2 and 3 in my pwd.
mkdir Public/{1..3} ---- This line creates folders 1,2,3 in Public only as ...
0
votes
0
answers
39
views
Deleting read-only directory on linux? [duplicate]
I created an empty read-only directory:
mkdir -m 400 ~/Desktop/hello
As per the octal permission, it indicates the directory has read only permission.
But contrast to that when I am using the ...
-4
votes
1
answer
206
views
mkdir not working, only with mkdir -p in rootserver with plesk [duplicate]
I just ordered a new root server 18.04 Ubuntu with Plesk.
I log in as root and want to create a folder for example:
mkdir /usr/local/myfolder/hello
I get the error:
mkdir: cannot create directory ‘/...
0
votes
1
answer
58
views
How to create nested folders (start with .) properly?
I want to create the nested folder .aa/.bb in the current user root's home directory. So I use the command mkdir -p "~/.aa/.bb/". But it doesn't work as I expected and it created a folder ~, ...
0
votes
1
answer
799
views
mkdir "No such file or directory" within a directory that exists
I have a network (samba) share mounted at /run/user/1000/gvfs/smb-share:server=wdmycloud,share=family. Most activities work fine within the share - I can move stuff around, create and delete files, ...
0
votes
2
answers
53
views
How to make sure directory only has specific subdirectories?
I have a directory that has some subdirectories with files in them. I have another directory that has very similar subdirectories but there may be a few that are added or removed. How can I add and ...
0
votes
2
answers
29
views
move contents of directory to static named subdirectory
I have directories of media structured as followed:
~ $ tree baz
baz
├── Ajin [Season 1]
│ ├── Ajin Demi-Human - 01 - A Topic That Has Nothing to Do with Us.mkv
│ ├── Ajin Demi-Human - 02 - Why Is ...
0
votes
1
answer
2k
views
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 ...
1
vote
0
answers
238
views
Why I cannot create a folder that does not exist (simple-mtpfs mounted filesystem)?
I am mounting my USB-connected phone using simple-mtpfs, and it is shown as fuse.simple-mtpfs when I do df.
I then switch to a folder on the external SDCARD of the phone, and try to create a folder ....
0
votes
2
answers
258
views
Creating nested directories
I want to write a bash script that will get a command line argument and create nested directories under the user home directory.
E.g a/b/c
mkdir -p $1/$2/$3
But I want create not just three levels ...
0
votes
1
answer
627
views
sudo mkdir in bash script without password
I need to manually create a directory using the following command in a cronjob and not have to enter in a password:
sudo mkdir /fold1/
I have read that I should not edit /etc/sudoers directly.
What ...
-1
votes
1
answer
66
views
How to create directory and files inside the directory
I want to know how to place files using touch command inside an directory whether it is multiple or single file.help is appreciated
0
votes
2
answers
1k
views
Can't mount /system read-write
When I make install reaver in termux the following error occurs:
./install.sh -D -m 755 wash /usr/local/bin/wash
mkdir: cannot create directory ‘/usr’: Read-only file system
make: *** [Makefile:140: ...
2
votes
1
answer
24
views
How can I quickly create all folders named {Single|Multi}Lane_{Single|Dual}Carriageway_{USA|Europe}
In Bash or Zsh, what is the shortest way to create a folder for each possible combination of substrings? Is there maybe even a notation such as
mkdir {Single|Multi}Lane_{Single|Dual}Carriageway_{USA|...
2
votes
1
answer
116
views
Regarding permissions on intermediate folders created using "mkdir -pm 764 a/b/c"
When I am using mkdir -pm 764 a/b/c
then only c got that 764 permission, while a and b have default permission. Why does it so? Why doesn't all directories get 764 permission?
0
votes
1
answer
33
views
Find all directories NOT containing matched subdirectory and create them
I have the following directory structure:
/media/storage/sqlbackup/CUSTOMER1
/media/storage/sqlbackup/CUSTOMER2
...
/media/storage/sqlbackup/CUSTOMER*
Each CUSTOMER* directory may contain ...
0
votes
0
answers
3k
views
Best way to chown on newly created directory via mkdir -p
Suppose I did a
mkdir -p a/b/c/d
and directories a,b (a/b) already exists. so it will only create c/d.
Now I want to only change the owner of directories c and d not a and b using chown.
chown -R ...
0
votes
2
answers
1k
views
Why does mkdir not work with wildcards? [duplicate]
nathan@gentoodesktop ~/Documents $ mkdir test
nathan@gentoodesktop ~/Documents $ mkdir te*/test
mkdir: cannot create directory 'te*/test': No such file or directory
nathan@gentoodesktop ~/Documents $ ...
2
votes
4
answers
15k
views
Creating directory in bulk using mkdir in shell script
I am trying to create directory in bulk using mkdir through shell script
below is the script
#!bin/bash
mkdir /tmp/report*/testfolder*/testdoank
when i run it i got an error
-bash: ./makefolder.sh: ...
1
vote
2
answers
667
views
Create directory with timestamp of newest files
I am trying to create a directory based on the timestamp of the 2 newest files in a directory and then copy those 2 files in to the newly created directory. SO for example
-rw-r--r-- 1 root root 0 ...
10
votes
5
answers
3k
views
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 ...
0
votes
2
answers
135
views
How to Move file using Script
I have been asked to design a script which when executed, moves the file types given in the arguments to the respective folder(creates the folder with file type if not there).
Like suppose I give ...
1
vote
1
answer
80
views
Create a folder for each file in a folder without the folder itself
| folderA1 | fileA11, fileA12, ...
folderA | folderA2 | fileA21, fileA22...
| ... | ...
I want to make a copy of it represented as:
| folderA1 | folderA11, folderA12, ...
...
3
votes
0
answers
24
views
How to create a directory behalf on root user? [duplicate]
I have a script:
[postgres@LaHarch ~]$ cat mkrundir.sh
#!/bin/bash
mkdir /run/postresql
With attributes:
[postgres@LaHarch ~]$ ll mkrundir.sh
-rwsr-sr-x 1 root root 74 Aug 26 18:53 mkrundir.sh
...
15
votes
3
answers
4k
views
Why did my folder names end up like this, and how can I fix this using a script?
Sorry if this has an answer elsewhere, I've no idea how to search for my problem.
I was running some simulations on a redhat linux HPC server, and my code for handling the folder structure to save ...