[ubuntu-uk] rsync chgrp problem - advice, please?

Robert McWilliam rmcw at allmail.net
Thu Jun 7 07:42:35 BST 2007


On Thu, 07 Jun 2007 07:02:06 +0100
luxxius <luxxius at googlemail.com> wrote:
> I can find all the files with the group that's causing the hiccup
> using
> 
> 	find /home/diana/music -group diana
> 
> Is there a simple way to redirect the results to chgrp root and then 
> chmod them to 664 so that I can automate this in future?

find can be used to run commands:

	find ~/music -group diana -exec chgrp root {} \; -exec chmod
		664 {} \;

for each result that find turns up it will run each of the commands
given as -exec arguments, replacing the {} with the file name. 

xargs could also be used here to substitute the results of the find
into arbitrary positions in other commands (useful when the results
come from something other than find which doesn't have a -exec or
equivalent).

________________________________________________________
Robert McWilliam     rmcw at allmail.net    www.ormiret.com

People who think they know what they are doing are especially annoying
to those of us who do.



More information about the ubuntu-uk mailing list