递归删除文件 [英] Recursively remove files

查看:85
本文介绍了递归删除文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人将Mac上的文件迁移到Linux服务器后,是否有解决方案来删除那些令人讨厌的._和.DS_Store文件?

Does anyone have a solution to remove those pesky ._ and .DS_Store files that one gets after moving files from a Mac to A Linux Server?

指定一个开始目录,然后放开它?像/var/www/html/下...

specify a start directory and let it go? like /var/www/html/ down...

推荐答案

更改到目录,并使用:

find . -name ".DS_Store" -print0 | xargs -0 rm -rf
find . -name "._*" -print0 | xargs -0 rm -rf

未经测试,请先在没有xargs的情况下尝试!

Not tested, try them without the xargs first!

您可以将查找后的时间段替换为目录,而不是先更改为目录.

You could replace the period after find, with the directory, instead of changing to the directory first.

find /dir/here ...

这篇关于递归删除文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆