[App Sharing] autotrash——自动清理你的回收站
Tofloor
poster avatar
神末shenmo
deepin
Spark-App
2023-07-04 07:38
Author

现在主流的安卓和苹果手机都有回收站功能,就是在删除文件之后不立即释放空间,而是放到回收站中,保留一段时间(一般是30天)后删除,这样防止反悔

Linux下有一个开源的工具,叫autotrash,然而是用python2写的,而且已经不再被主流发行版收录了。为了解决这个问题,我用bash写了个阉割版的autotrash,仅仅保留了定时删除的功能(其实基本就够了),用GPT做了国际化支持之后上传到了星火商店

基本用法:

用法: /usr/bin/autotrash -d <天数>
检查Linux默认回收站中的文件的删除时间。当删除时间和当前时间的差值大于某个指定的时长的时候,则删除并提示。
选项:
  -d, --days <天数>    指定的时间长度(以天为单位)
  -h, --help           显示帮助信息

比如 autotrash -d 30,就是删除回收站中已经过了30天的文件。把这个东西添加到开机任务中,就可以做到回收站自动清理,这样就可以在删除文件的时候随心所欲不用担心误删,又不必担心回收站爆满了

这里是一个使用的例子

[Desktop Entry]
Version=1.0
Name=trash-autoclean
Name[zh_CN]=自动清理30天以上的回收站
Comment=
Type=Application
Exec=sh -c "autotrash -d 30 && notify-send 自动清理回收站30天以上的文件完成 -i user-trash-full" 
Icon=user-trash-full
Categories=Utility

把这段配置文件保存为.desktop结尾(比如trash-clean.desktop),放到 ~/.local/share/applications/里,就可以在启动器中看到了。这时候只要加上开机启动就可以快乐地每次开机自动清理回收站了



这个鬼东西通过ChatGPT支持了中英日和繁体中文,详情可以参考 https://gitee.com/spark-community-works-collections/transhell/blob/master/Let-GPT-Help.txt

图片.png

Reply Favorite View the author
All Replies
hanzn-zzx
deepin
2023-07-04 07:44
#1

like感谢神末大佬!(能直接接入deepin的回收站吗?)

Reply View the author
神末shenmo
deepin
Spark-App
2023-07-04 07:48
#2
hanzn-zzx

like感谢神末大佬!(能直接接入deepin的回收站吗?)

接入是没办法了,可以用文中的方法外挂


链接修复了,可以下载了

Reply View the author
秋胜春朝
deepin
2023-07-04 14:24
#3

like

Reply View the author
阿尼樱奈奈
Moderator
2023-07-04 14:49
#4

这个必须点赞👍🏻like

Reply View the author
jjcui8595
deepin
2023-07-04 14:59
#5

感谢分享

Reply View the author
xuqi
deepin testing team
2023-07-04 16:29
#6
  • 不错~以后可以偷下懒~~
Reply View the author
青稚
Moderator
2023-07-04 17:03
#7

已点赞like

Reply View the author
Merlin
Super Moderator
Product Manager
2023-07-04 18:04
#8

有规划未排上期,这个功能其实很早在云桌面管理中就有的功能了。
image.png

Reply View the author