Unlike Linux which has lots of GNU utilities like ‘maxdepth’, ‘depth’ etc… Solaris(and perhaps other flavors of Unix) doesnt have a similar utility to specify the depth of the ‘find’ command. After some Googling I found a way to do this on Solaris.
Find below –
To find all in a directory(to just list you can use the ‘ls’ command of course)find . \( ! -name . -prune \) -type f
I wanted to find the all the zero KB files in the current directory, so it is:find . \( ! -name . -prune \) -type f -size 0
Then, I wanted to delete them:find . \( ! -name . -prune \) -type f -size 0 | xargs rm -f