I have a script that generates backup and finds files older than 30 days and compresses them. Now the problem I'm facing is if the files are more than one than how can I edit the script so that it compresses all those files as well. Below is the find function Im using. Please Help.
Time=+30 PATH_TO_DUMP=/home/tarun/Desktop/Backup #Find any Backup File defined by the time constraint file="$(find $PATH_TO_DUMP -type f -mtime $Time)" #To verify if $file is empty or has some value if [ ! -n "$file" ]; then echo "No Earlier Backups were found to compress" >> $PATH_TO_LOG else echo "Earlier Backups $file will be compressed" >> $PATH_TO_LOG gzip $file fi