Hi All,
OS: Redhat Linux 7.5
Shell: Bash
I have some folder like this
2018-09-16
2018-09-17
2018-09-18
2018-09-19
and so on...
Everyday one script create a folder with pattern YYYY-MM-DD (it will have so many sub directories files in it)
Now what I would like to achieve is a cron job should run every day 7 AM then it should check for previous day folder then zip it(tar.gz) with same name and delete the folder once tar is created successfully..
for example: if cron running on 2018-10-16 then it should find folder called 2018-10-15 --> tar it like tar -zcvf 2018-10-15.tar.gz 2018-10-15
--> then delete rm -rf
of that 2018-10-15 folder
though i have clear cut of idea of step, finding difficult to list previousday folder by searching pattern...please help