Get filename before renaming?

How to get the original filename for a file after somebody renames it?

Here's an example scenario

  1. Someone upload a file called a.txt
  2. Someone rename a.txt to b.txt
  3. I want to copy this b.txt to another drive with original filename which is a.txt.

How would you know #2 happened? What OS? What file system?

On, right click on the file - select view details - select activity tab.
I can see the renaming action and filename before renaming.

Is that exposed in the API as well?

Yes, it does have exposed API.

So let me repeat back and see if we're on the same page.

  • poll the drive api activity log for a file name change, not an upload
  • if change, copy new file to another remote with original file name

Definitely an interesting use case.

Yes, basically what I want is when I run "rclone copy" or "rclone sync", rclone will check the files needed to be copied have been renamed or not.
If renamed, the filename should be changed back to the original filename when copied to new destination.

Does these make sense to you?
What I am thinking is we can have a flag for user to decide if they want to check for renaming.

The tricky part is you'd have to get the drive activity for a specific file which I'm not sure is in the metadata for that specific file.

If it is, seems straight forward. If not, polling the entire activity log seems not feasible to figure out if something changed.

It also breaks on a crypt remote as you'd never know what the original name was as the crypt name is stored.

I can't fathom why I'd want to do that in a use case. Can you explain what the need is for that as this feels complex to me to solve and quite an outlier of a use case.

From this post, it seems we can get the drive activity for a specific file.

For crypt remote, is it possible we can decrypt the crypt name assuming the key hasn't changed?

So let me explain why I need this.
We have a team drive to share pirated files, we always rename file to a less meaningful name in order to avoid DMCA takedown.
I don't own this team drive and can't control the renaming.
I have another crypt drive to backup the main team drive.
Since it's mine and it's crypt drive so I want the meaningful filename back.

That would be best implemented as a backend specific command if someone wants to have a go. It could print the history of the file.

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