Skip to main content

Posts

Showing posts from February, 2014

How to find and delete files under a directory not looking at subdirectories in Solaris

How to find and delete files under a directory not looking at subdirectories in Solaris? In GNU linux there is a –maxdepth option to ‘find’ command which can be used to prevent looking at subdirectories but it is not available for Sun solaris. I use the below approach, here I want to remove all files except from NOTSENT and RESEND and which are older than 1 day. find . -type d \( -name NOTSENT -o -name RESEND \)  -prune -o -type f -mtime +1 -print -exec rm -rf {} \; try 'man find' on solaris for more details.