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

In the code that I support, I look through:

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

In Python27\Lib\site-packages\win32comext\shell\ (note win32comext) I have a binary file shell.pyd .

  • What is the shell.SHFileOperation return value for deletion ( operation=FO_DELETE in the call above)? Where is the code for shell.pyd?
  • Is it possible to get a list of files actually deleted from this return value, or do I need to manually check it after?

EDIT: accepted answers to Q1 answers - view source pywin32-219\com\win32comext\shell\src\shell.cpp I see that static PyObject *PySHFileOperation() delegates to SHFileOperation , which does not seem to return any information about which the files could not be deleted, so I think the answer to Q2 is "no."

0
pywin32
Mar 14 '15 at 19:23
source share
1 answer

ActiveState Python Help contains a SHFileOperation description :

shell.SHFileOperation

int, int = SHFileOperation (operation)

Copy, move, rename, or delete a file system object.




Options

: SHFILEOPSTRUCT

Determines the operation to be performed.




Return value

The result is a tuple containing the int result of the function itself, and the result of the fAnyOperationsAborted member after the operation. If the flags contain FOF_WANTMAPPINGHANDLE, the returned tuple will have a 3rd member containing a sequence of 2 tuples with the old and new file names of the renamed files. It will only be content if FOF_RENAMEONCOLLISION is specified, and some file name actually conflicts occurred.

The source code can be downloaded here: http://sourceforge.net/projects/pywin32/files/pywin32/Build%20219/ (pywin32-219.zip)

Just unzip and go to .\pywin32-219\com\win32comext\shell\src\

+1
Mar 16 '15 at 12:37
source share



All Articles