In article 20071121102709.GH12494@br-online.de, Ralph Angenendt ra+centos@br-online.de wrote:
William L. Maltby wrote:
On Wed, 2007-11-21 at 10:04 +0100, Ralph Angenendt wrote:
Shad L. Lords wrote:
find . -type type -print0 | xargs -0 chmod value
Or (SUSV compliant):
find . -type f -exec chmod 123 {} +
Easier to type and more natural (for me). But less efficient than the xargs version since each file cause a new process to be spawned. For a very large number of items the difference would be noticeable.
Wrong.
-exec command {} + This variant of the -exec option runs the specified command on the selected files, but the command line is built by appending each selected file name at the end; the total number of invo- cations of the command will be much less than the number of matched files. The command line is built in much the same way that xargs builds its command lines. Only one instance of {} is allowed within the command. The command is executed in the starting directory.
And yes, that works on mostly any Unix (as said: SUSV compliant), while many commercial unixes have "interesting" implementations of xargs and -print0 (or don't have that at all).
Maybe, but unless it works on CentOS 5, it is irrelevant to this list. It certainly is not available in the "find" on CentOS 4:
[root@hostname ~]# find /home/user/ -type f -exec echo {} + : find: missing argument to `-exec' [root@hostname ~]#
Cheers Tony