[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: find -exec



On Fri, Nov 12, 1999 at 11:48:49PM -0800, aphro wrote
> What i wanna do ..is 2 things
> 
> find all files in a directory tree and chmod them 644
> 
> find all directories in a directory tree and chmod them 775
> 
> and i'm trying to do it with the find -exec command.  For the directory
> part i did get this working:
> chmod 7755 `find . -type d`
> 
> but for the file part chmod said there was too many files so i wanan try
> to do it with the -exec option in find.  can someone give me a command
> that would work for this ?  ive treid several variations on this command:
> 
> find . -exec chmod u+wx {} -type f
> 
> to no avail ..no matter what i do it keeps saying its "missing argument to
> `-exec' i've tried escaping it with \ tried single and double quotes,
> tried calling a single command with no arguements i moved the -exec
> command to the end of the find command ARGH NOTHING! There are about 5,000
> files i need to modify.
> 
> plz help someone :))
> 

As others have suggested, you are looking for something like
 $ find . -type f -exec chmod 644 {} \;

However, on the off chance that you want directories to be 755 and 
not 775, which makes sense to me if the files are 644, you may want 
to check out
 $ chmod -R u=rwX,go=rX .
which will set files to 644 (assuming that they are not
already executable) and directories to 755 with a single
pass through the tree, without spawning an new process for
every file.


John P.
-- 
huiac@camtech.net.au
john@huiac.apana.org.au
"Oh - I - you know - my job is to fear everything." - Bill Gates in Denmark


Reply to: