python win32com shell.SHFileOperation - 有什么方法可以获取实际删除的文件?

python win32com shell.SHFileOperation - any way to get the files that were actually deleted?

在我维护的代码中,我 运行 跨越:

from win32com.shell import shell, shellcon
# ...
result,nAborted,mapping = shell.SHFileOperation(
        (parent,operation,source,target,flags,None,None))

Python27\Lib\site-packages\win32comext\shell\ 中(注意 win32comext)我只有一个 shell.pyd 二进制文件。

  1. 删除 shell.SHFileOperation 的 return 值是多少(上面调用中的 operation=FO_DELETE)? shell.pyd 的代码在哪里?
  2. 我可以从这个 return 值中获取实际删除的文件列表,还是我必须事后手动检查?

编辑:已接受的答案 Q1 - 查看 pywin32-219\com\win32comext\shell\src\shell.cpp 的来源,我看到 static PyObject *PySHFileOperation() 代表 SHFileOperation 似乎没有 return有关哪些文件未能被删除的信息 - 所以我猜对 Q2 的回答是 "no".

ActiveState Python help contains SHFileOperation description:

shell.SHFileOperation

int, int = SHFileOperation(operation)

Copies, moves, renames, or deletes a file system object.


Parameters

operation : SHFILEOPSTRUCT

Defines the operation to perform.


Return Value

The result is a tuple containing int result of the function itself, and the result of the fAnyOperationsAborted member after the operation. If Flags contains FOF_WANTMAPPINGHANDLE, returned tuple will have a 3rd member containing a sequence of 2-tuples with the old and new file names of renamed files. This will only have any content if FOF_RENAMEONCOLLISION was specified, and some filename conflicts actually occurred.

源代码可以在这里下载:http://sourceforge.net/projects/pywin32/files/pywin32/Build%20219/ (pywin32-219.zip)

只需打开包装并前往 .\pywin32-219\com\win32comext\shell\src\