简体   繁体   中英

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. 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. Before the the rename operation is performed, the source folder is being deleted by calling CF_CALLBACK_TYPE_NOTIFY_DELETE callback.

Here is the sequence of callbacks that I get with Cloud Filter API:

  1. CF_CALLBACK_TYPE_NOTIFY_DELETE is called on the source folder.
  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.

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

How do I properly implement the delete and rename/move callbacks in Cloud Files API?

It is specific of Windows File Manager. I tried "Move" operation using PowerShell "Move-Item" with "-Force" option and I got next sequence of callbacks (without delete callbacks):

  1. CF_CALLBACK_TYPE_NOTIFY_RENAME
  2. CF_CALLBACK_TYPE_NOTIFY_RENAME_COMPLETION

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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