Rclone copy a folder with a space in the name , can't get script to work?

Dear all.

Im trying to use ajkis upload script : https://github.com/ajkis/scripts/blob/master/rclone/rclone-upload.sh but with some minor modifications. Instead of moving file, I want to copy them since my torrent client is still seeding the downloaded content. But im getting an error that the folder TV Serier is wrong.

Output from shh :

find: ‘/home/plex/Media/TV’: No such file or directory
find: ‘Serier/*’: No such file or directory

How do I sort that part out? :slight_smile:

#!/bin/bash

RCLONE UPLOAD CRON TAB SCRIPT

Type crontab -e and add line below (without #)

* * * * * /home/plex/scripts/rclone-upload.cron >/dev/null 2>&1

modify line 20 config file location

if pidof -o %PPID -x “rclone-upload.cron”; then
exit 1
fi

LOGFILE="/home/plex/logs/rclone-upload.cron"
FROM="/home/plex/Media/TV Serier/"
TO=“Google:/Backup/TV Serier/”

CHECK FOR FILES IN FROM FOLDER THAT ARE OLDER THAN 25 MINUTES

if find $FROM* -type f -mmin +15 | read
then
echo “$(date “+%d.%m.%Y %T”) RCLONE UPLOAD STARTED” | tee -a $LOGFILE

COPY FILES OLDER THAN 15 MINUTES

/usr/sbin/rclone copy --config=/home/plex/.config/rclone/rclone.conf $FROM $TO -c --no-traverse --transfers=10 --checkers=10 --bwlimit 50M --log-file=$LOGFILE
echo “$(date “+%d.%m.%Y %T”) RCLONE UPLOAD ENDED” | tee -a $LOGFILE
fi
exit

Also I read that I had to use the full path of rclone for the script to work… which I dont know anything of… I had major problems just to get crone to work.

So I added the path /usr/sbin/rclone

But the I add to crontab -e

          • /home/plex/scripts/rclone-upload.cron >/dev/null 2>&1

The cronjob aint running, but if I replace rclone-upload.cron to rclone-upload.sh its working .
Am I doing something wrong here? Just have problems with the folder naming.

Do we agree when using rclone copy it checks which files that are present on the googledrive, it dont upload and overwrite existing files ?

If I have 4 folders I want to upload, what would be the best solution to run a cronjob .

Lets say I have these folders:
TV Serier
Movies
Animation
Oldies

Do I make and edit the script for each folder so I call the script rclone.uploadMOV.sh , rclone.upload.ANI.sh etc , and them add them to user crontab -e ?

Do I add them all by:

          • /home/script/script1.sh or .cron?
          • /home/script/script2.sh or .cron?

Thinking if all is executed at the same time, it probably would use insane cpu usage and upload speed?

Thanks for reading and hopefully helping me :slight_smile

Regards

Morphy

Everywhere you use $FROM and $TO you should have them “inside quotes”

eg

... find "$FROM"* ...

rclone ... "$FROM" "$TO" ...

Otherwise the spaces inside filenames will be expanded and will break things.

Ahh ty :slightly_smiling_face:
Wrote Ajki a PM regarding my issue with cron :slight_smile: