Directories without 'x'

Michael Hipp Michael
Wed Feb 23 09:10:19 PST 2005


Well, I'm proud of myself 'cause I solved a problem that had been giving me 
headaches for weeks. I have some cron scripts that do things with deep 
directory trees that have 10,000s of files in them. Eventually found out that 
deep down there were a bunch of directories not set executable, like this:

drw-r-xr-x    2 michael  michael         6 2005-02-23 07:57 test
    ^
I found out that directories without the 'x' are very bad actors. Bash scripts 
fail in mysterious ways or keep running but don't do anything or sometimes 
seem to work fine, etc. Anyway, eventually solved it like this:

To paint a target on them:
   find -type d ! -perm +u+x -exec ls -ld '{}' \;

To fix the problem:
   find -type d ! -perm +u+x -exec chmod u+x '{}' \;

Thought I'd pass it along while I'm feeling cocky :-)

Michael


More information about the Linux-users mailing list