All Questions
Tagged with mkdir shell-script
18
questions
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
2
answers
911
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
99
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-...
4
votes
1
answer
6k
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 "...
0
votes
0
answers
79
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
2
answers
1k
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 ...
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 ...
1
vote
1
answer
4k
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 ...
0
votes
2
answers
112
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=...
0
votes
2
answers
345
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 ...
1
vote
2
answers
8k
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 ...
3
votes
1
answer
520
views
Create directories from lines of a file [duplicate]
I'm cating a file, and the output is something like this:
Help me my friend
Temptation
Sorrow
True Love
Vanilla Sky
I was here
SOS
...
I'm trying to create directory of all of these lines.
What I ...
1
vote
1
answer
443
views
Folders created with script have wrong modified timestamp
I have the following script:
#------------------------ SETTINGS
FOLDER_NAME="$(date '+%Y_%b_%d')"
LOG_PATH=/home/alex/logs/backup-seafile-$FOLDER_NAME.log
DIR_PATH=/mnt/data/Backups/Seafile
...
-1
votes
1
answer
621
views
Sub Directories in sub directory using loop
On my CentOS machine, I need to create a main directory inside which I will have a few sub directories and, inside them, some subsubdirectories.
Something like:
main_directory->sub1,sub2,sb3..
...
0
votes
2
answers
4k
views
use of if else in linux to find whether the folder exists or not
I have the following bash script:
if [ -d "/$home/DB_handouts"] then
echo "Directory DB_handouts found"
else
mkdir /$home/DB_handouts
chmod 777 /$home/DB_handouts
fi
Running the above code ...