I have an installation script that unzip
s a directory, then recursively chmod
s its contents.
I'm surprised it takes almost 10 times the time it takes to unzip, to run the following two commands:
find $dir -type f -exec chmod a+r "{}" \;
find $dir -type d -exec chmod a+rx "{}" \;
Am I doing something wrong, is there a faster way to change the chmod of all files and directories?
-exec chmod a+r "{}" \;
trychmod a+r "{}" +
instead. The first will run the command chmod once for every directory. The later command will run chmod a few times, with a list of directories as options (iechmod dir1 dir2 dir3 dir4
). This means far few processes are created.+
trick is blazing fast! Can you add your comment as an answer?