Thursday, June 23, 2011

Find 3.2

While find can be used to recursive perform an operation on files with the -exec flag, doing so can be costly. In the case of recursive permissions, you could change

find . -type f -exec chmod 644 {} + -o -type d -exec chmod 755 {} +

To

chmod -R a+rX .

This recursively adds the read bit to all files, and if the execute bit is set for user, group, or other on the file, it is applied for all else. If you're updating 10000+ files, this will run much faster. (And it's easier to type.)

No comments:

Post a Comment