Job Schedule on Windows

Hello all. First topic here. To start things off, I would like to thank ncw and all the people involved for this really useful little piece of software, been using it for quite some time now and I couldn’t give up on it.

On the topic of my question. I’m not really an IT expert, so i’m struggling on setting thins up properly. I’m using Windows 10 and i can use rclone through the cli just fine, however I would like to setup an automation for my finished jobs to start as soon as it finishes.

For my case in particular, i’m downloading files to a specific Downloads folder, however my disk space is limited and so i would like to send them to my Drive as soon as they have finished downloading. I’m using jDownloader as my download manager, the files that are still downloading have a “.part” extension so its easy to give exclude filters for the downloading files.

I did try something like was debated here Struggling to schedule an RClone job but i’m not sure if its because i’m mixing apples and potatoes (win and linux) or it’s just plain ignorance on my part, I couldn’t make it work.

This was the script I opened on Cygwin64 (not sure if its the appropriate software for it but i gave it a try), the script is saved on I:\rclone.sh

LOCKFILE=“I:/basename $0
(
flock -n 9 || {
echo “$0 already running”
exit 1
}

export RCLONE_CONFIG_PASS=(my config pass)
rclone move --ignore-existing -v --transfers 16 --checkers 16 --exclude *.part I:\Downloads gsuite:“Foo/Bar/Downloads”

) 9>$LOCKFILE

It showed me this:
./rclone.sh: line 2: $’\r’: command not found
./rclone.sh already running
: numeric argument required1

I’m sorry for my noobness but is there an easier way to achieve this on Win10? Thanks in advance.

I think I’ve found a cleaner solution that works for windows using a simple bat file. This is what it looks, very basic stuff.

@echo off
cls
:start
cls
rclone move -u -vv --transfers 16 --checkers 16 --exclude *.part I:\Downloads gsuite:Foo/Bar/Downloads --ask-password=false
goto start

I had to set up the environment variable for RCLONE_CONFIG_PASS and it seems to be working with a couple of test files I’ve created. The script keeps running in the background and as soon as a file is created on that folder it’s uploaded automatically to the specified remote. I’ll have to test this further to see if it triggers any api limits, creates duplicate files or other things like that but for now is working as intended.

2 Likes

This will be because the file has windows line endings - you can convert it to unix line endings with dos2unix

1 Like

I see. That was my main concern, that I was just mixing things up. Not being extremely tech savvy and working mostly on windows based systems, that tends to happen from time to time eheh. Thanks for clarifying the error though, it will certainly be useful in the future.

Although extremely basic, the .bat solution I found as been running like clockwork since I posted it here, with no issues whatsoever, if anyone whats to automate the process of restarting a job on windows give it a try.

1 Like