Keeping URL on Google Drive when file is updated by rclone

What is the problem you are having with rclone?

I am a novice user and trying to copy files from a Raspberry Pi to a Google Drive and generate a URL that can be shared. When I use the command:
rclone copy image.jpg gdrive:/Public2 --ignore-checksum
the image.jpg file overwrites the version in gdrive:/Public2, which is what I want to happen, but when I click on the shared URL, I get a message "Preview not available File is in owner's trash"

Is there a way to keep the URL the same when image.jpg is updated? I have a program that generates a new image.jpg every 5 minutes and don't want to keep changing the shared URL.

Or, am I using the wrong tool for this job?

Thanks.

What is your rclone version (output from rclone version)

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

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

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

Paste command here

The rclone config contents with secrets removed.

Paste config here

A log from the command with the -vv flag

Paste  log here

If you replace the file, the URL won't work anymore as that's how Google Drive works.

It would not matter which tool you used.

But if you use a web browser there is an option to upload a new version of a file as a replacement for the current one and the URL does not change. I had hoped that there was an option in rclone to do the same.

Rclone should be uploading a new version of a file

image

And when I did that the sharing link for the file updated showing the new version.

The important thing is that rclone says this (use the -v flag to see)

2021/04/19 22:31:35 INFO : test.txt: Copied (replaced existing)

1 Like

Sorry as I must have done something strange the first time when I tested as @ncw is correct.

felix@gemini:~$ rclone copy /etc/hosts GD: -v
2021/04/19 17:36:51 INFO  : hosts: Copied (replaced existing)
2021/04/19 17:36:51 INFO  :
Transferred:            37 / 37 Bytes, 100%, 57 Bytes/s, ETA 0s
Transferred:            1 / 1, 100%
Elapsed time:         1.0s

Same link worked when I pasted it in the second time as well and I can see the new file.

Thanks for the responses...I used the -v option and it worked intermittently until I realized that I wasn't giving Google Drive enough time to process the uploaded file. If I tried the shared URL immediately, I would get a message that the file was in the "owner's trash" -- but if I waited a few minutes (between 3-5 minutes) and retried, it worked. Presumably if I tried the shared URL immediately, Google Drive was still moving the original file to the trash before allowing the updated file to be accessed.

Again, thanks for the quick responses

1 Like

Ah that is interesting. I didn't know that google might need some time to make the shared URL work again after an upload.

How big is the file?

Ok...I guess I was premature in declaring victory. It is true that after uploading a new file, you have to wait a few minutes before accessing it via the shared URL, but I just setup a cron job to upload a new file (5 Mb jpg image file) every 10 minutes and everything was going along just great and I was able to access the newly uploaded files with the same shared URL. Then for some reason, after I stepped away for dinner, I noticed that it stopped working and the shared URL now displayed a message that the file was in the trash. I tried clearing the browser cache, used a new type of browser, etc. but no luck. The only way to resolve it was to create a new shared URL. I checked the google drive directory, and the date/time stamp shows the new file was successfully uploaded, but for some reason, when the old file is deleted (moved to trash), the shared URL is not correctly updating.

The files are 5 MB jpg files. I have an all sky camera based on a Raspberry Pi that takes an image every few minutes and I want to upload that to Google Drive and give people the URL to see the image.

The version of rclone is
rclone v1.54.1

  • os/arch: linux/arm
  • go version: go1.15.8

And the command I am using is

rclone copy -v –ignore-checksum ~/allsky/image.jpg gdrive:/AllSkyCam-Public2 (set to run every 10 minutes in crontab)

Thanks

I have a vague memory that the number of versions you can have is limited, so you can only have 100 versions - I wonder if that is a problem.

I also wonder if maybe you updated the image before google had finished sorting out the shared link for the previous one?

I kept monitoring the google drive and noticed that once, both the old and new file showed up and after a few minutes, the old file went away. Other times, the old file was gone by the time I refreshed the browser window. I did find a workaround....since I was trying to do with 3 different files (2 refresh daily, and one refreshes every 10 minutes), I just share the link for the directory that contains all 3 files. That link is stable...it means one extra mouse click, but it's worth it for the stability.

Thanks

Great - glad you found a solution.

If you didn't mind paying a very small number of cents per month, you could push the files up to a public amazon s3 bucket and share URLs from there. These would be guaranteed to work. You could even upload a bit of html and put them into a web page.