从命令行递归删除文件

I'm one of those people who can't stand a messy laptop;  I don't keep around files I don't need and I refuse to install apps unless I absolutely need them.  Unfortunately Mac OS X and Windows generate files whenever they like, like .DS_Store and Thumbs.db.  Sure they serve their purpose but that doesn't mean the clutter doesn't annoy me.

我就是那些无法忍受一台凌乱的笔记本电脑的人。 我不会保留不需要的文件,除非我绝对需要它们,否则我将拒绝安装应用程序。 不幸的是,Mac OS X和Windows会根据需要.DS_Store生成文件,例如.DS_StoreThumbs.db 。 当然,它们能够达到目的,但这并不意味着混乱不会使我烦恼。

If you want to recursively find delete files you don't want, there's a simple way to do that:

如果要递归查找不需要的删除文件,有一种简单的方法可以做到这一点:


find . -name '.DS_Store' -type f -delete


You can use * as a wildcard too:

您也可以将*用作通配符:


find . -name '*.zip' -type f -delete


Of course my cleanup only lasts a short time, but hey -- you can use this command for more intelligent purposes!

当然,我的清理只会持续很短的时间,但是,嘿,您可以使用此命令来达到更智能的目的!

翻译自: https://davidwalsh.name/recursively-delete

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值