All Questions
36
questions
-2
votes
1
answer
631
views
how to create a directory that already exists with another name
i want to create directory called "A" inside my home directory but i don't know if such a directory already exists. i want to write a command that creates the directory if it does not exist. ...
1
vote
1
answer
773
views
Create directory using filenames and move the files to its respective folder
My question is a bit different than:
Create directory using filenames and move the files to its repective folder
Since in the same folder I have two similar copy of each file like:
001.txt and 001(1)....
0
votes
1
answer
296
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 ...
1
vote
1
answer
136
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 /...
4
votes
4
answers
976
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 ...
1
vote
1
answer
178
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
2k
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
59
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
691
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 ...
3
votes
1
answer
29
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|...
0
votes
1
answer
38
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 ...
1
vote
2
answers
1k
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 ...
1
vote
1
answer
99
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, ...
...
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 ...
7
votes
2
answers
6k
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