Howdy... I'm looking to chmod 777 a
whole bunch of files. Alternatively, since it's more secure, I could also settle for a
chown www:www of these files to make them web
accessible.
Now, since I have over
400,000 files, sudo chmod -R 777 ./*
and sudo chown
didn't work at all, returning only with "Arg list too
-R www:www ./*
long"
Some googling turned up
find
and xargs
, but this didn't quite
work for my file set, since some of the files had underscores in the name. I'm not sure
why this would break the script, but it did. The
command:
find ./ -name "*" | xargs
chmod 777
Here's an
anonymized snippet of the directory
tree:
files
\-
28934723
\- file1.xml
\- file2.txt
\-
34905834
\- file1.xml
\- file2.txt
\-
21398230
\- file1.xml
\-
file2.txt
As
far as I can tell from man find
, it should recurse into
subdirectories automatically, but I am not sure. When I ran the above command,
some of the files changed, but the majority of the directories
remained the same (same permissions).
Thanks in
advance for any help you guys can offer :)
sudo chown -R www:www ./
and if you don't want the
directory owned by www, just change it back.
Comments
Post a Comment