On my Linux system, I've got into a situation where there are not write/execute permissions on directories on a mounted drive. As a result, I can't get into a directory before I open its permissions up. This happens every time I mount that drive. The mounting operation is done by a tool under its hood, so I doubt if could modify mount parameters to address this problem.As a workaround, I am using this find command to modify permissions on directories. I use it repetitively, since it gets one more level of directories on each run.find . -type d -print0 | xargs -0 -n 1 chmod a+wrxI am sure there is a better way to do this. I wonder if there is a find option that processes a directory first and then its contents - the opposite of -depth|-d option.Any tips?
How to process directory first, then files and directories under it?
find
Try:find . -type d -exec chmod a+rwx {} ';'This will cause find to execute the chmod before it tries to read the directory rather than trying to generate a list and feed it to xargs.