I am trying to write a shell script in which I want to take tar backup of the folders which are formed on daily basis.
For example my parent directory name is "log" and under this directory a directory will be created automatically on daily basis and all the child directory (which are formed on daily basis) will have several log files created hourly.
Main purpose: I want to take tar backup of the child directory (which are created on daily basis with directory name as 01, 02, 03, 04, ...... ,31) by retaining the last 20 days log files. Means out of 30 day's directory, tar should be done only for first 10 days.
find /usr/local/aryan/2015/logs -iname ".log" -mtime +10 -exec tar -cvzf backup_1.tar.gz" "VARIABLE_FOLDER_NAME" '{}' \;
Please help me to replace the "VARIABLE_FOLDER_NAME" which actually will have the folder names which will be created on daily basis.
Through above command, it will find all the files having extension as .log and are not modified in last 10 days. Now I want to take backup of all those folders which contains files with .log as extension