Deleting GDrive files with multiple parents might lead to unexpected data loss

One of the most unexpected behaviors on Google Drive might be that a file can have multiple parent directories. rclone current does little to handle this subtlety, but this might lead to unexpected data loss, like this following scenario:

There is a file ./dir1/file.
$ rclone sync ./ remote:dir1
On the web interface, copy dir1/file to dir2/file. Note that there is still just one single object, but it has two parents: dir1 and dir2.
Now remove dir1/file, and do
$ rclone sync ./ remote:dir1
At this time, we’d expect dir2/file to be intact, but it would actually be deleted by the last sync command.

I’d suggest that when trying to delete a remote file, check its parents first. If it has only one parent, delete it as usual. In the rare cases that it has multiple parents, instead of deleting it, remove the parent we are targeting from its parents. This way, the semantics of deletion is closer to what we expect from most cloud services.

Does this make sense?

Absolutely.

Can you please make a new issue on github with this in - thanks! Maybe you’d like to implement it too?