How can I stop script when command "find" gets to a folder with permission denied.
I make a list of all folders in my PC.
I would like to stop the searching process when "find" finds a permission denied folder.
DIRS=$(find . -type d)
Thanks a lot
How can I stop script when command "find" gets to a folder with permission denied.
I make a list of all folders in my PC.
I would like to stop the searching process when "find" finds a permission denied folder.
DIRS=$(find . -type d)
Thanks a lot
Can't test this now, but you should check with exec if the folder is executable.
Something like
find -type d -print0 -not -exec test -x '{}' \; -quit