Help with script? (idk what title)

What is the problem you are having with rclone?

I want make daily backups on my dropbox it works fine with cron but i want make it like this
today i got folder test on my dropbox and tomorrow i want folder test1 and next tomorrow folder test2 instead overwriting test folder so i can get backup from 4 days instead yesterday (i dont know if u guys understand me my english is not perfect sorry)

What is your rclone version (output from rclone version)

rclone v1.51.0

  • os/arch: linux/amd64
  • go version: go1.13.7

Which OS you are using and how many bits (eg Windows 7, 64 bit)

Ubuntu 18.10 64bit

Which cloud storage system are you using? (eg Google Drive)

Dropbox

The command you were trying to run (eg rclone copy /tmp remote:tmp)

a .sh script
#!/bin/sh
if [ -z "$STY" ]; then exec screen -dm -S backup -L -Logfile '/root/logs/log' /bin/bash "$0"; fi
rclone copy --update --verbose --transfers 30 --checkers 8 --contimeout 60s --timeout 300s --retries 3 --low-level-retries 10 --stats 1s "/root/test/file" "dropbox:test"
exit

hello and welcome to the forum.

you should read this:
https://rclone.org/commands/rclone_sync/

rclone sync “/path/to/local/folder” “dropbox:/test/current” --backup-dir “dropbox:/test/archive”`date -I`
  1. the first time you run the above command rclone will copy all local files from /path/to/local/folder to dropbox:/test/current/
  2. then you modify a local file such as /path/to/local/folder/file.txt
  3. then you run the command again and rclone will
    a. move the file dropbox:/test/current/file.txt to dropbox:/test/archive/date/file.txt
    b. copy the /path/to/local/folder/file.txt to dropbox:/test/current/file.txt

read about it here:
https://rclone.org/docs/#backup-dir-dir

when testing you want to use the flag
https://rclone.org/docs/#n-dry-run

let me know if you have questions?

It is a little hard to understand you - but is "versioning" what you are trying to make?
So that can "go back in time" to find an old version of a file?

Then --backup-dir is a function you will want to use. Please read the link asdffdsa provided.

Asdffdsa and me actually made a script that does this (timestamped versioning) for someone else:


Unfortunately this is batch-script (for windows), but the rclone commands would be basically the same, and it would not be so hard to translate this to bash-script for Linux. You can just use our script as an example if you know bash.

That script creates dated versioning, so that you can go back to any date where a file was "deleted" or "overwritten" and recover it - because instead of actually deleting it will be moved to a timestamped folder.

Please let me know if I need to explain in simpler english, or if I have misunderstood what you need :slight_smile:

it works like almost i wanted if i add date %s but it only archives changed file. i want entire folder

try this

rclone sync “/root/test/file” “dropbox:test/”`date %s`

and test by adding flag --dry-run

not working, i mean i want archive unchanged files too. it only puts changed files

i do not understand what you want?

what is your command?

and -vv to the command for debug output

and post the output.

i figured it out, but how i can put date like this test2020-03-15-16-50 so it will have hour and minutes and current day

date "+%Y%m%d.%H%M"

Why do you want also the unchanged files in dated versioning?

This is very possible to do, but you would be re-saving a copy of all the data every time a change was made. This would be incredibly inefficient use of space - and very impractical unless maybe it is only small text-files?

It would make much more sense to just reconstruct the full data from a spesific time - and when you have the up-to-date files + copy of all changes you can do this. Saving hundreds of copies of identical files would just be wasteful and slow.

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