I am looking to have a non-destructive way to mirror a folder on remote and a local folder. I would like to know if the following code in cronjob will do what I am expecting:
(The above commands are in a single line. I used linebreaks here just for readability)
I tried the first two lines and the copy happens properly.
When I move a file to a different location, I am getting duplicate files since the copy command does not delete the source files.
I was curious to know:
Can I run sync commands after copy commands, assuming the sync command to remove the duplicate file in the destination after the copy command has copied the moved file.
if these four commands execute sequentially waiting for one command to complete the job and then run the next command. Or will they get executed simultaneously confusing the processes?
will just one file lock be enough?
Run the command 'rclone version' and share the full output of the command.
rclone v1.58.1
os/version: raspbian 11.3
os/kernel: 5.15.32-v7l+ (armv7l)
os/type: linux
os/arch: arm
go/version: go1.17.9
go/linking: static
go/tags: none
Which cloud storage system are you using? (eg Google Drive)
Google Drive
The command you were trying to run (eg rclone copy /tmp remote:tmp)
The copy command shouldn't be making duplicate files though they do happen sometimes for reasons unknown. You can get rid of them with rclone dedupe.
As you've written it, the sync commands won't do anything. The two copy commands effectively make "googledrive-folder:" and "/my-local-folder" identical already.
They will run one after the other
It would be better to write all the statements in a bash file with a single lock like this, and call the bash file off the crontab.
Thank you so much for taking out your precious time to give a detailed reply to my question.
When I move a fileA, let's say from source/folderA to source/folderB, the copy command is keeping the fileA in the destination/folderA and creating a new fileA in destination/folderB (while the source and destination will be googledrive and raspberry pi in one command and in the next command the reverse)
So the two copy commands are not (at least in my case) making the two folders identical. Am I missing something?
(Also I just noticed that the second copy command is bringing back the fileA to source/folderA, so that the fileA is now in both the folders on source as well as destination)
I really appreciate the clear answer that you have given to my question
Apologies for the confusing sentence.
First copy command creates duplicate file in the destination. so the googledrive and localfolder are not identical.
The second copy command is again recreating the moved file by copying it from the localfolder to googledrive. Now the googledrive and localfolder are identical but with duplicate files.
Logically speaking this the expected behavior of the copy operation, but I was trying to understand the answer
"the copy command shouldn't be making duplicate files"
How safe is bisync? I mean is it as reliable as the native mirroring done by googledrive apps on windows?