Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

help with find command

Status
Not open for further replies.

bobbybobbertson

Programmer
Nov 9, 2001
119
US
I want to find all the directories within a directory older than 2 day. However I don't want find to return any directories that start with a dot (.).


The following would work with perl regex's but it seems it doesn't work with find:
find -regex /home/sites/home/web/dl/ph/[^\.] -type d -mtime +2 -exec echo {} \;

any ideas?
tc
 
woops that should have been...

find /home/sites/home/web/dl/ph/ -regex "[^\.]" -type d -mtime -2 -exec echo {} \;

but that still doesn't seem to work
 
What's wrong with
[tt]find /home/sites/home/web/dl/ph/ -type d -mtime -2 -print | grep -v '[^.]'[/tt]
?

//Daniel
 
That does seem to work. I had to get rid of the negation ^ in '[^.]'


Also, my goal was to use the -exec part to remove the files. So instead of -exec echo {}, once I got it working, I would use -exec rm -r {}

But I bet that part could be done by piping your output into xargs or something.


thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top