Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

bash: Filtering out directories and extensions from find?

Tags:

find

bash

I'm trying to find files modified recently with this

find . -mtime 0

Which gives me

en/content/file.xml
es/file.php
en/file.php.swp
css/main.css
js/main.js

But I'd like to filter out the en and es directories but would like to grab anything else. In addition, I'd like to filter out .swp files from the results of those.

So I want to get back:

css/main.css
js/main.js
xml/foo.xml

In addition to every other file not within es/en and not ending in .swp

like image 468
meder omuraliev Avatar asked Dec 01 '22 05:12

meder omuraliev


1 Answers

properly, just in find:

find -mtime 0 -not \( -name '*.swp' -o -path './es*' -o -path './en*' \)
like image 145
mvds Avatar answered Dec 04 '22 05:12

mvds