Hello, I've got a CentOS box and users are putting Windows long files on it, files with " " and " - " in their filenames. I'm trying to adjust the permissions as well as user and group membership and i'd like the changes to be sticky. On the tld i've set permissions of 2755 and am trying to batch convert the files and subfolders in it. I've done this:
find tld -type f |xargs chmod 644 {} ; find tld -type d |xargs chmod 755 {} ;
Both of these are failing due to the spaces and dashes. I've tried enclosing those {} in quotes, no good. Has anyone done this with shell or perhaps perl? Thanks. Dave.
Hi,
On Wed, Aug 19, 2009 at 17:02, Davedave.mehler@gmail.com wrote:
I've got a CentOS box and users are putting Windows long files on it, files with " " and " - " in their filenames. I'm trying to adjust the permissions as well as user and group membership and i'd like the changes to be sticky. On the tld i've set permissions of 2755 and am trying to batch convert the files and subfolders in it. I've done this:
I believe what you want is 2775 and 664 (group writable), right?
find tld -type f |xargs chmod 644 {} ; find tld -type d |xargs chmod 755 {} ;
Both of these are failing due to the spaces and dashes. I've tried enclosing those {} in quotes, no good. Has anyone done this with shell or perhaps perl?
Use "-print0" in find and "-0" in xargs. Also, you don't need the "{} ;", that is syntax for "find -exec" which you are not using.
I think what you want is:
$ find tld -type f -print0 | xargs -0 chmod 664 $ find tld -type d -print0 | xargs -0 chmod 2775
HTH, Filipe
Dave wrote:
Hello, I've got a CentOS box and users are putting Windows long files on it, files with " " and " - " in their filenames. I'm trying to adjust the permissions as well as user and group membership and i'd like the changes to be sticky. On the tld i've set permissions of 2755 and am trying to batch convert the files and subfolders in it. I've done this:
find tld -type f |xargs chmod 644 {} ; find tld -type d |xargs chmod 755 {} ;
Both of these are failing due to the spaces and dashes. I've tried enclosing those {} in quotes, no good. Has anyone done this with shell or perhaps perl?
You've got 'find' syntax and 'xargs' syntax hopelessly mingled. Here:
find tld -type f -print0 | xargs -0 chmod 644 -- find tld -type d -print0 | xargs -0 chmod 755 --
The "-print0" and "-0" use the ASCII NUL character as the argument delimiter, so any legal path can be passed without being mangled. The "--" tells chmod that none of the following arguments that might begin with '-' should be treated as options.
Hi, Thanks everyone for the responses. The issue has been solved. Thanks. Dave.
-----Original Message----- From: centos-bounces@centos.org [mailto:centos-bounces@centos.org] On Behalf Of Robert Nichols Sent: Wednesday, August 19, 2009 5:21 PM To: centos@centos.org Subject: Re: [CentOS] replacing permissions on uploaded windows files
Dave wrote:
Hello, I've got a CentOS box and users are putting Windows long files on
it,
files with " " and " - " in their filenames. I'm trying to adjust the permissions as well as user and group membership and i'd like the changes to be sticky. On the tld i've set permissions of 2755 and am trying to batch convert the files and subfolders in it. I've done this:
find tld -type f |xargs chmod 644 {} ; find tld -type d |xargs chmod 755 {} ;
Both of these are failing due to the spaces and dashes. I've tried enclosing those {} in quotes, no good. Has anyone done this with shell or perhaps perl?
You've got 'find' syntax and 'xargs' syntax hopelessly mingled. Here:
find tld -type f -print0 | xargs -0 chmod 644 -- find tld -type d -print0 | xargs -0 chmod 755 --
The "-print0" and "-0" use the ASCII NUL character as the argument delimiter, so any legal path can be passed without being mangled. The "--" tells chmod that none of the following arguments that might begin with '-' should be treated as options.