Re: changing permissions of files in directories
Once upon a time Colin Watson said...
> On Wed, Oct 08, 2003 at 10:04:01AM +0000, Adam wrote:
> > On Wednesday 08 October 2003 08:00, Lukas Ruf wrote:
> > > find <path> -type f | xargs chmod 0644
> >
> > I would have come up with
> >
> > find PATH -type f -exec chmod 0644 '{}' ';'
> >
> > Is the version with xargs better, and how?
>
> The version with xargs is much better: it runs a single instance of
> chmod with all the files (or as many as will fit) as arguments, rather
> than running a separate instance of chmod for every file.
I use xargs because its easier to type, so I can type it faster.
> The downside is that you can only use xargs this way for programs that
> let you specify an arbitrary number of filenames lasting up to the end
> of the command line.
xargs -n 1 <command>
will limit xargs to running the command with 1 argument
In response to the original question, if you dont want to recurse into
all the subdirectories, use -maxdepth 1:
$ find . -type f -maxdepth 1 | xargs chmod 644
Reply to: