pythonlinuxapifreedesktop.org

Python API to Access Trash Folder


I am looking for a good python API to access the Trash folder in Linux. This is part of a simple productivity software that will help user organize their files, and empty their trash folder on a regular basis. I want to make this work for GNOME, but I would like to expand it to other desktop environment.

Do you have any suggestion on how to get one ?

Thank you


Solution

  • I don't think that there is an API for that. I think (or rather, the voices in my head on the internet say) "Empty Trash" is a map to rm -rf ~/.Trash/*. (Actually, that should be true for both KDE and Gnome, but I don't know about XFCE, Slim or XKCD. Of course, if you have XKCD as a windows manager, I don't think you'll ever need to worry about trash.)