简体   繁体   English

如何使用终端删除mac中子文件夹下的常用文件

[英]How to delete common files under subfolders in mac using terminal

i have directory like我有目录

dir A目录 A

--B file a --B 归档一个

--c file a --c 文件

--D file a --D 归档一个

A is parent dir and B, C and D are child of A and all child folder contain a file a which i want to delete in one go using terminal. A 是父目录,B、C 和 D 是 A 的子目录,所有子文件夹都包含一个文件 a,我想使用终端在一个 go 中删除该文件。 I tried below cmd but did not work我在 cmd 下面试过但没用

find. -regex '\b[FreeCoursesOnline.Me].url\b' -print0 | xargs -0 rm

It's not your method that's wrong - it's just your regex.错的不是你的方法——而是你的正则表达式。

How to use regex with find command? 如何在 find 命令中使用正则表达式? talks about using the regex with the find command, and what regex flavor it might support.谈论使用带有 find 命令的正则表达式,以及它可能支持的正则表达式风格。 In any case, [ and ] have special meaning.在任何情况下, []都有特殊的含义。 Outside of [] , .[]之外, . also has special meaning.也有特殊意义。 As far as I could determine with a quick glance, none of the find implementations I saw provided a regex engine that supported the \b word boundary.据我快速浏览确定,我看到的所有find实现都没有提供支持\b单词边界的正则表达式引擎。

Not exactly but below cmd can work不完全是但低于 cmd 可以工作

find . -name '*.txt' -delete

we can find out all the all the file with specific extension and can delete in one go我们可以找出所有具有特定扩展名的文件,并可以在一个 go 中删除

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM