Dear friends, I need your help.
I need to create a bash script which can loop through $source_dir once a month, and find the backup of the last day of a given month for each of the 2 file types, as can be seen below.
Assume that source_dir="/backup/daily"
Assume that dest_dir="/backup/monthly"
Assume that the 2 types of files are:
this-file-.gz
that-doc-.tar.gz
...as can be seen below.
Type 1:
- this-file-other-week.gz
- ............
- ............
- this-file-other-day.gz
- this-file-yesterday.gz
- this-file-today.gz
Type 2:
- that-doc-other-week.tar.gz
- ............
- ............
- that-doc-other-day.tar.gz
- that-doc-yesterday.tar.gz
- that-doc-today.tar.gz
The script should then pick the 2 files (separately) which have been backed up at the end of the month, and backup each one of them in $dest_dir with such names as:
- this-file-monthly.gz
- that-doc-monthly.tar.gz
I am having trouble with this particular component of the script and any help is highly appreciate.
Thank you