我一直在绞尽脑汁,并尝试了不同的方法来成功完成它。以下是我正在运行的Cron作业。如果找到$ FROM *-类型f -mmin +15 |在“读”处,我试图在同一文件夹/ Downloads /中搜索以某个字母(例如“ a”)开头的文件夹。我尝试了很多不同的方法,但是没有运气,它会填满整个页面。将找到每个带有字母“ a”的文件夹,或者给我命令错误,或者转到子文件夹以获取信息。
if pidof -o %PPID -x "$0"; then
exit 1
fi
LOGFILE="/home/user/logs/uploadlog.log"
FROM="/home/user/Downloads/"
TO="Google:Upload/New/"
# CHECK FOR FILES IN FROM FOLDER THAT ARE OLDER THAN 15 MINUTES
if find $FROM* -type f -mmin +15 | read
then
start=$(date +'%s')
echo "$(date "+%d.%m.%Y %T") RCLONE UPLOAD STARTED" | tee -a $LOGFILE
# MOVE FILES OLDER THAN 15 MINUTES
rclone move "$FROM" "$TO" --transfers=20 --checkers=20 --delete-empty-src-dirs --min-age 15m --log-file=$LOGFILE
echo "$(date "+%d.%m.%Y %T") RCLONE UPLOAD FINISHED IN $(($(date +'%s') - $start)) SECONDS" | tee -a $LOGFILE
fi
exit