linux - 递归删除文件

有没有人有解决方案来删除那些在将文件从 Mac 移动到 Linux 服务器后得到的讨厌的 ._ 和 .DS_Store 文件?

指定一个起始目录并让它离开?比如/var/www/html/下...

最佳答案

切换到目录,然后使用:

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

未测试,先不带 xargs 试试!

你可以用目录代替find后面的句点,而不是先换目录。

find /dir/here ...

https://stackoverflow.com/questions/2016844/

相关文章:

python - 如何用下划线替换空格?

linux - 如何在 Apache 服务器上自动将 HTTP 重定向到 HTTPS?

linux - 在 Ubuntu 中轻松更改 $JAVA_HOME

linux - 如何在不覆盖 TTY 的情况下将密码传递给 su/sudo/ssh?

python - 如何在 Python 中将字符串转换为 utf-8

python - 如何为 popen 指定工作目录

windows - 如何让 Windows 在编译 C++ 时与 Linux 一样快?

python - matplotlib 错误 - 没有名为 tkinter 的模块

linux - 如何在没有密码的情况下以另一个用户身份运行脚本?

linux - 如何打印 ld(linker) 搜索路径