如何以 pythonic 方式 manipulate/clean Linux 垃圾文件夹?

How to manipulate/clean the Linux Trash folder the pythonic way?

我知道 Linux 中的 Trash 文件夹是如何构建的。 所以用一些低级文件系统命令直接操作它不会那么难。

我也知道 Ubuntu GNU/Linux 的 trash-cli 包。

如果没有上述两种解决方案,pythonic 清理 Linux 上的回收站文件夹的解决方案是什么?

我的提问背景: 我知道有些文件管理器不使用 trash-cli 包程序。他们怎么做到的?是否有 python 包或库(gtk、qt、...)?

我会检查 trashman or autotrash,它们都基于 python,因此它们可以导入到您的脚本中并以编程方式调用。

"trash folder" 并不是 Linux 本身的一部分。它通常是构建在 Linux.

之上的桌面环境的一部分

基本上它是 freedesktop.org 中关于 "trash can" 实现应该如何工作的 specification