Files
Bash_Scrips/ssh_loops/loop_array.sh
2025-06-23 21:19:51 +02:00

13 lines
336 B
Bash

#!/bin/bash
#find only derctoris older then 10 days
DIR_NAME=($(find /opt/backup/database/ -maxdepth 1 -type d -ctime +10))
for dir in "${DIR_NAME[@]}"
do
echo "tar -cvPf $dir.tgz $dir --remove-files"
done
#this will tar and remove
#tar -cvf /home/roy/Desktop/test/some_dir.tgz /home/roy/Desktop/test/some_dir --remove-files