Skip to main content

All Questions

Tagged with
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 ...
Mathijs's user avatar
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 ...
nidooooz's user avatar
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-...
Lucas Djeu's user avatar
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 "...
Raegor's user avatar
  • 43
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 ...
akoontz11's user avatar
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 ...
Aayush Upadhyaya's user avatar
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 ...
Bamboo's user avatar
  • 495
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 ...
Mark's user avatar
  • 733
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=...
novice's user avatar
  • 45
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 ...
King Boi's user avatar
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 ...
NapoleonTheCake's user avatar
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 ...
Parsa Samet's user avatar
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 ...
SHiLLySiT's user avatar
-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.. ...
Aditya Agarwal's user avatar
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 ...
Ann's user avatar
  • 13

15 30 50 per page