Rclone + windows, which is best script language? .bat? powershell?

I am sticked to windows + rclone,
I wanna write script that say ask for current time stamp,
and then do rclone copy source target with logfile–timestamp,
among other functions.

I think for the coming 10 years I will stick with windows + rclone,
what will be the best script language for this?
.bat batch?

WHATIF if 10years later I want
rclone + windows + linux?
for this which script language will be better?

thank you.

Would be nice if someone can show some rclone scripts on windows and/or linux.


the solution to all your questions is to use python for the script, as it runs on windows and linux.
the syntax of batch files is cryptic and difficult to write and debug.

I have 150+ line python script, that handles all my backup needs, even beyond rlcone.
the script can also copy files with fastcopy, zip files with 7z and read configuration information from .ini files.

as you mentioned, timestamps are important for logs file.
it is also important for the --backup-dir flag.
here is an example of the rclone command.
notice that I use timestamps for both the log file and --backup-dir flag

rclone.exe sync "c:\data\key" wasabiwest01:en09-key\backup\ --stats=0 --progress --backup-dir=wasabiwest01:en09-key\archive\20190911104039\ --log-level DEBUG --log-file=C:\data\rclone\logs\key\20190911104039\key_20190911104039_rclone.log

let me know if you have any questions

Look at cygwin, you will have the rich linux command line environment to work with and can write bash script. You could also go as far as writing make files.

Python is an alternative but isn't well suited to an application that mostly makes system calls. Things get very verbose when managing all the things that can go wrong with a system call. If you insist on python then have a look at snakemake. Don't be discouraged by its scientific niche.

10 years is a very long time and your script needs are very simple.

if you want to understand rclone on windows, read this post which has a nice simple script from my good friend and demon @thestigma and i contributed to it.
you can use that activesync script as a starting point

and read my wiki about integrating VSS with rclone

based on your needs, powershell is extremely and deeply integrated into windows, with over 1000+ cmdlets building into windows 10.
and it has a nice gui development environment and debugger using microsoft's excellent and free visual code.
powershell is like bash but with support for objects.
and powershell runs on linux.

if you are a programmer, like i am, and already use python, that is the way to do.
python runs on many operating systems, has fantasic support for system calls, has a debugger and can be compiled into a simple .exe.
my python script is now over 350+ lines of code and has over a dozen system calls.

If you want to make something from scratch, then python is the way to go. You won't be locked down to any spesific platform and it's easy, modern and powerful. It may not be preisntalled on any OS, but it is pretty trivial to install it anywhere you want.

Batch is easy enough, but also limited buggy and weird because it's older than dirt. It's only really "good" for the (very) basic stuff. If you have more than basic needs it will start to become more of a hindrance to you than anything. I have some fairly advanced batch scripts I use myself, but it took way more time than it should have to make them, and I would probably re-do that functionality in python if I invested more time into improving my own scripts. The more advanced you get in batch the more you rely on understanding how to work around the bugs and weird quirks of the language than anything else. It's pretty much a dead end in terms of making anything serious, so unless you have spesific backwards compatibility needs I would not really recommend it despite using it myself.

Powershell is very good in terms of what it can do, but it's a nightmare to learn. It is also purely for Windows. I don't really see the benefit of using it for rclone and general OS control scripting as you won't need the very Windows spesific stuff that is it's main strength over other languages. You just need something general.

Check out the link asdffdsa gave you. The script there shows how to use timestamps and integrate it into logs and files. If you need more spesifc help - feel free to ask, although I will be a bit busy for a while and may take a few days to respond. Asdffdsa knows a lot about this too though.