3

I have a directory with lots of files and inside a mounted directory.

var/
   log/
   nfs/ (a NFS remote directory)
   www/

How can I chmod/chown everyfiles inside that directory without changing nfs ones.

Natim
  • 626
  • 1
  • 6
  • 16

1 Answers1

4

Well my solution was to use find to do that:

find . -xdev -exec chown myuser:mygroup {} \;
Natim
  • 626
  • 1
  • 6
  • 16
  • 4
    You could make that a bit faster by doing something like: `find . -xdev -exec chown myuser:mygroup {} \+` – Bill Weiss Aug 08 '13 at 17:06
  • and I prefer combining `find` with `-exec` rather than piping it to `xargs` (check here http://stackoverflow.com/questions/896808/find-exec-cmd-vs-xargs ) for a bit of background... – Petter H Aug 08 '13 at 19:14
  • \+ or \; here `find . -xdev -exec chown myuser:mygroup {} \;` – Natim Aug 12 '13 at 08:02