Find and excluding directory
Hi
I have to use find to change the perms of a directory and files within that directory recursively but i need to exclude a directory within the top level directory, as its a netapp and so contains a read only .snapshot dir. I have tried... # find /var/data/foo -path './.snapshot' -prune -o -exec chown usera:groupb {} ; but chown: changing ownership of `/var/data/foo/.snapshot': Read-only file system chown: changing ownership of `/var/data/foo/.snapshot/hourly.0': Read-only file system chown: changing ownership of `/var/data/foo/.snapshot/hourly.0/filename': Read-only file system any clue ? thanks _______________________________________________ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos |
Find and excluding directory
Tom Brown wrote:
> Hi > > I have to use find to change the perms of a directory and files within > that directory recursively but i need to exclude a directory within the > top level directory, as its a netapp and so contains a read only > .snapshot dir. > > I have tried... > > # find /var/data/foo -path './.snapshot' -prune -o -exec chown > usera:groupb {} ; > > but > > chown: changing ownership of `/var/data/foo/.snapshot': Read-only file > system > chown: changing ownership of `/var/data/foo/.snapshot/hourly.0': > Read-only file system > chown: changing ownership of > `/var/data/foo/.snapshot/hourly.0/filename': Read-only file system Your "-path" argument is wrong. Try this: find /var/data/foo -path '/var/data/foo/.snapshot' -prune -o -exec chown usera:groupb {} + You need the whole path, and there is no need to escape the '.' character. I've also used "+" as the terminator. That's just an efficiency issue. It makes 'find' build command lines with as many matches as will fit rather than invoking 'chown' separately for each one. -- Bob Nichols "NOSPAM" is really part of my email address. Do NOT delete it. _______________________________________________ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos |
Find and excluding directory
> Your "-path" argument is wrong. Try this:
> > find /var/data/foo -path '/var/data/foo/.snapshot' -prune -o -exec chown > usera:groupb {} + > > You need the whole path, and there is no need to escape the '.' character. > I've also used "+" as the terminator. That's just an efficiency issue. It > makes 'find' build command lines with as many matches as will fit rather > than invoking 'chown' separately for each one. > > Hi Robert many thanks - that resolved ths issue for me tom _______________________________________________ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos |
| All times are GMT. The time now is 05:49 AM. |
VBulletin, Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.