Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- ftp_dir="path/to/catalog"
- archive_dir="$ftp_dir/archive"
- datetime=$(date +%d.%m.%Y)
- remove_days="30"
- if [[ $(find $ftp_dir -maxdepth 1 -type f | wc -l) == 0 ]]; then
- exit 0
- else
- mkdir $archive_dir/$datetime
- find $ftp_dir -maxdepth 1 -type f -print0 | xargs -0 -I {} mv {} $archive_dir/$datetime
- chown -R www-data: $archive_dir/$datetime
- fi
- find $archive_dir -mtime +$remove_days -delete
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement