find and regex

Hello.

I'm creating a script which delete all mails older than 45 days in .Junk directory.

So this instruction works:

Code:
find . -regex '.*Junk/cur/.*' -ctime +45 -maxdepth 5 -print


It works. I see all my expired mails. However, I want to remove expired mails in Junk/cur and Junk/new. I does not want to create 2 commands.

This instruction does not work:

Code:
find . -regex '.*Junk/\(cur\|new\)/.*' -ctime +0 -maxdepth 5 -print


I have no errors. No mails are listed. Do you have any idea? My OR does not work in this instruction.

Thanks a lot.

Regards
 
Try

Code:
find -E . -regex '(.*Junk/cur/.*|.*Junk/new/.*)' etc.

or

Code:
find -E Junk/ -regex '(.*/cur/.*|.*/new/.*)' etc.

of course.
 
DutchDaemon said:
Try

Code:
find -E . -regex '(.*Junk/cur/.*|.*Junk/new/.*)' etc.

or

Code:
find -E Junk/ -regex '(.*/cur/.*|.*/new/.*)' etc.

of course.
Oh yeah, it works! Thanks a lot!
 
Back
Top