Move file only not the folder

I am trying to fine tune my cron job. I am wanting to move all files (mkv) in one folder to another folder and delete the folder once the file is moved. This way all the .rar files are deleted and they are not getting uploaded later to gdrive. I tried below format and it still moved the folder with the .mkv file.

if pidof -o %PPID -x "$0"; then
   exit 1


if find $FROM* -type f -name "*.mkv" -mmin +15 | read
  start=$(date +'%s')
  echo "$(date "+%d.%m.%Y %T") RCLONE UPLOAD STARTED" | tee -a $LOGFILE

  rclone move "$FROM" "$TO" --transfers=4 --checkers=4 --delete-empty-src-dirs --min-age 15m --log-f$
  echo "$(date "+%d.%m.%Y %T") RCLONE UPLOAD FINISHED IN $(($(date +'%s') - $start)) SECONDS"$ | tee$

I've tried using this command in my crontab. It works fine but crontab kind of stops running when it cannot find any files to move or delete

find /home/user/Downloads/Porn/Porn/Sports/ -name "*.mkv" -type f -exec mv '{}' /home/user/Downloads/Porn/Porn/Sports_Final/ \;
 find /home/user/Downloads/Porn/Porn/TVShows/All_TV_Shows/ -name "*.mkv" -type f -exec mv '{}' /home/user/Downloads/Porn/Porn/TVShows/AllTVShows/ \;
 find /home/user/Downloads/Porn/Porn/Blu_Ray/ -name "*.mkv" -type f -exec mv '{}' /home/user/Downloads/Porn/Porn/Blu_Ray_Final/ \;
 find /home/user/Downloads/Porn/Porn/4KMovies/ -name "*.mkv" -type f -exec mv '{}' /home/user/Downloads/Porn/Porn/4KMovies_Final/ \;

Why not just run the rclone command every time? It will exit very quickly if there aren't any files older than 15m?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.