0

i have directory like

dir A

--B file a

--c file a

--D file a

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. I tried below cmd but did not work

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

2 Answers2

1

It's not your method that's wrong - it's just your regex.

How to use regex with find command? talks about using the regex with the find command, and what regex flavor it might support. 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.

erik258
  • 14,701
  • 2
  • 25
  • 31
0

Not exactly but below cmd can work

find . -name '*.txt' -delete

we can find out all the all the file with specific extension and can delete in one go