I'm trying to find all the web folders that are 777. But I only want a list of the top folders.
So if there is an img dir that has folders in it that are also 777 I don't want them returned.
Basically I'm looking for a way to have find stop descending after finding a folder that's 777.
find /var/www/vhosts/ -type d -perm 777
Gives me
/var/www/vhosts/example.com/httpdocs/img
/var/www/vhosts/example.com/httpdocs/img/gbl
/var/www/vhosts/example.com/httpdocs/img/ss
And all i want is the first one
/var/www/vhosts/example.com/httpdocs/img
Use the -prune flag.
find /var/wwwhosts/ -type -d -perm 777 -prune
should show exactly what you want.Edit: Here's what this is doing for me, I believe this is what you wanted?