rclone/rclone

Google Drive handling of Duplicate Files and Directories

开放

#4,412 创建于 2020年7月5日

 (6 条评论) (4 个反应) (0 位负责人)Go (5,090 个派生)batch import
Remote: Driveenhancementhelp wantedversioning

仓库指标

星标
 (57,185 个星标)
PR 合并指标
 (平均合并 32天 20小时) (30 天内合并 23 个 PR)

描述

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".

贡献者指南