简体   繁体   English

重命名文件夹并覆盖删除云文件中的源文件夹 API

[英]Rename folder with overwrite deletes the source folder in Cloud Files API

I am creating a virtual file system using Cloud Files API. I am trying to implement rename/move and delete operations for folders.我正在使用 Cloud Files API 创建一个虚拟文件系统。我正在尝试对文件夹实施重命名/移动和删除操作。 The rename folder with overwrite scenario (when the target folder exists) behavior is confusing.具有覆盖场景的重命名文件夹(当目标文件夹存在时)行为令人困惑。 In Windows Explored I am trying to rename Z:\Folder1 to Z:\Folder2 while the Z:\Folder2 already exists.在 Windows Explored 中,我试图将 Z:\Folder1 重命名为 Z:\Folder2,而 Z:\Folder2 已经存在。 Before the the rename operation is performed, the source folder is being deleted by calling CF_CALLBACK_TYPE_NOTIFY_DELETE callback.在执行重命名操作之前,正在通过调用 CF_CALLBACK_TYPE_NOTIFY_DELETE 回调删除源文件夹。

Here is the sequence of callbacks that I get with Cloud Filter API:以下是我使用 Cloud Filter API 获得的回调序列:

  1. CF_CALLBACK_TYPE_NOTIFY_DELETE is called on the source folder.在源文件夹上调用 CF_CALLBACK_TYPE_NOTIFY_DELETE。
  2. Each file from source folder is being moved to the target folder.源文件夹中的每个文件都被移动到目标文件夹。
  3. CF_CALLBACK_TYPE_NOTIFY_DELETE_COMPLETION is called on the source folder.在源文件夹上调用 CF_CALLBACK_TYPE_NOTIFY_DELETE_COMPLETION。

As a result there is no way to delete a folder in my storage inside the CF_CALLBACK_TYPE_NOTIFY_DELETE callback because this will delete all files prior to the move operation.因此,无法在 CF_CALLBACK_TYPE_NOTIFY_DELETE 回调中删除我存储中的文件夹,因为这将在移动操作之前删除所有文件。 Also there is no way to distinguish between delete and move operations inside the CF_CALLBACK_TYPE_NOTIFY_DELETE (so I can ignore it for the move operation).也没有办法区分 CF_CALLBACK_TYPE_NOTIFY_DELETE 内部的删除和移动操作(所以我可以忽略它来进行移动操作)。

How do I properly implement the delete and rename/move callbacks in Cloud Files API?如何在 Cloud Files API 中正确实施删除和重命名/移动回调?

It is specific of Windows File Manager.它特定于 Windows 文件管理器。 I tried "Move" operation using PowerShell "Move-Item" with "-Force" option and I got next sequence of callbacks (without delete callbacks):我尝试使用带有“-Force”选项的 PowerShell“Move-Item”进行“移动”操作,我得到了下一个回调序列(没有删除回调):

  1. CF_CALLBACK_TYPE_NOTIFY_RENAME CF_CALLBACK_TYPE_NOTIFY_RENAME
  2. CF_CALLBACK_TYPE_NOTIFY_RENAME_COMPLETION CF_CALLBACK_TYPE_NOTIFY_RENAME_COMPLETION

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM