如何根据返回的不区分大小写的delta删除文件系统中的文件?

我正在尝试编写代码来完成Dropbox Core API
python SDK中的这个特殊情况
documented.

[path, nil]: Indicates that there is no file/folder at the path on Dropbox. To update your local state to match, delete whatever is at path, including any children (you will sometimes also get “delete” delta entries for the children, but this is not guaranteed). If your local state doesn’t have anything at path, ignore this entry.

API指出返回的[path]不区分大小写.

Remember: Dropbox treats file names in a case-insensitive but case-preserving way. To facilitate this, the path strings above are lower-cased versions of the actual path. The metadata dicts have the original, case-preserved path.

如果我不知道路径的大小写保留版本,如何从我的系统中删除有问题的文件或目录?

如果它是相关的,我的操作系统是Linux,虽然我希望得到一个可以在Windows上运行的解决方案,如果可能的话.

最佳答案 如果您需要能够从较低的套管路径恢复具有原始套管的路径(例如,对于本地区分大小写的文件系统),则一种解决方案是将降低的路径映射到原始路径客户端.具体的实现细节取决于您,但任何简单的键值存储都可能完成这项工作.

然后,当您获得其中一个删除时,可以使用此映射查找原始路径并相应地处理它.

点赞