I have a set of folders (let's assume at /home/20161
, /home/20162
, /home/20163
) which have been timestamped already. at the end of the day, I'd like to collect all of them and move to a main directory, timestamped, at the same path (/home/Main(date of today
) including the aforementioned folders) using a shell script.
How can I do this?
Any kind of help is appreciate it
I use this script to time stamp the files into separate folders but don't know how to continue it for folders:
#!/bin/bash
cd /home/sina/Desktop/Recordings/
shopt -s nullglob # this line is so that it does not compain when no logfiles are found
for filename in Screen.mkv; do # Files considered are the ones startign with test and ending in .log
foldername=$(date +%Y%m%d_%H%M%S); # Create Folder based on date of time of recording
mkdir -p "$foldername" # -p so that we dont get "folder exists" warning
mv "$filename" "$foldername"
echo "$filename $foldername" ;
done
for filename in Webcam.mp4; do
mv "$filename" "$foldername"
echo "$filename $foldername";
done
/home
? It's typically for user's personal directories , not for storing files. Also, this is a very simple question. Have you tried anything by yourself so far ? Why or why not ?/home/
was just an example. the right path is included in updated post