0

I am developing a file shredder for windows 32 using Python 2.7. One of the desired features is be able to shred all recycle bin contents.

As for other files, outside of the recycle bin, we implemented a "shred" function, which overwrites the file contents with garbage, and deletes the file.

However, in order to use this "shred" function on the recycle bin contents, we considered using this library. Using this library we can undelete the item first (restore it), then shred it. But, this method is not suitable because:

  1. It may confuse the user who will shred the recycle bin contents, as he might see recycle contents appearing again in the file system while shredding.

  2. Windows will display the "Resotring" dialog box, while the undelete function is running. This is not desirable.

Is there any advice on how to implement a recycle bin shredder?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Ababneh A
  • 1,104
  • 4
  • 15
  • 32
  • You could always just shred everything in the user's hidden RECYCLER directory. Windows will regenerate the index. – nneonneo Feb 21 '13 at 11:51
  • I found the "Recycler" direcotry on XP. Does the "Recycler" directory exist in Vista and Windows 7 as well? – Ababneh A Feb 21 '13 at 11:57

1 Answers1

2

You can use the shell module from Pywin32 to get the real path:

from win32com.shell import shell, shellcon
idl = shell.SHGetSpecialFolderLocation(0, shellcon.CSIDL_BITBUCKET)
d = shell.SHGetDesktopFolder()
sf = d.BindToObject(idl, None, shell.IID_IShellFolder)

for i in sf:
    print sf.GetDisplayNameOf(i, shellcon.SHGDN_NORMAL)
    print sf.GetDisplayNameOf(i, shellcon.SHGDN_FORPARSING)
Roger Upole
  • 434
  • 3
  • 5