Reputation: 209
I'm having issues with this statement, have no idea why it's not working, probably having syntax problem but can't figure out where. Script should find directories that contains in name @tmp or numbers with dots, and after finding a match - remove them. But it's not happening.
find /home/user/data/ -type d \( -name "*@tmp" -o -regex "[0-9\.\/]+" \) -exec rm -r {} \;
Upvotes: 2
Views: 603
Reputation: 212298
You are looking for:
find . -type d \( -name '*@tmp*' -o -regex '.*/[0-9.]+' \) ...
There's nothing magical about @
or t
that require them to be escaped, and regex matches the whole path so you need to match the leading elements.
Upvotes: 3