Google Drive handling of Duplicate Files and Directories
#4.412 aberto em 5 de jul. de 2020
Métricas do repositório
- Stars
- (57.185 estrelas)
- Métricas de merge de PR
- (Mesclagem média 32d 20h) (23 fundiu PRs em 30d)
Description
What is your current rclone version (output from rclone version)?
1.52.2
What problem are you are trying to solve?
The handling of duplicate files and directories in source - Google Drive
How do you think rclone should be changed to solve that?
Summary: incorporate dedupe mechanics into sync/copy affecting only the destination, but using object ID instead of numerical increments on new names.
Currently, rclone will just grab one of the duplicate files/directories and ignore the others. However, entries with the same name are officially supported by Google Drive, so rclone should also support it. Drive windows client handles it by adding a character, usually _, to the name. But with the Windows client it is easier since they can have a stateful cache of sorts so they can always treat the same file in the same way. The way I imagine rclone handling it is changing either the directory name or the file basename (identified by the usual dot before extension) and adding _ followed by the last character from the object ID. If the names still clash, fall back and add the last 2 characters. For example, if we have 2 directories called Video, we could end up, for instance, with Video_A and Video_4 (considering A and 4 are the last digits of the object ID for the location). Or Video_A2 and Video_32 if both objects IDs end in 2. For a file, rclone could detect a) it is a file and not directory and b) separate the extension, so we could have Blahblah_D.odt and Blahblah_5.odt. This approach would work even if we have more than 2 objects with the same name. Of course, ideally, only one (the "second") would have its name changed. However this could cause problem unless some kind of local storage is maintained so the same object would always be identified as the "first".