Tema: Re: chmod ir daug folderiu?
Autorius: AndriuZ
Data: 2012-02-09 10:48:28
dekui paanalizuosim


"Nerijus Kislauskas"  parašė naujienų 
news:jgvu9e$l15$1@trimpas.omnitel.net...

On 02/08/2012 04:39 PM, ejs wrote:
> aš labiau mėgstu
> `find . -type d -exec chmod 0755 {} '+'`
> `find . -type f -exec chmod 0644 {} '+'`

Iš find manualo:

--exec
....
There are unavoidable security problems surrounding use of the -exec
action; you should use the -execdir option instead.

--execdir
Like  -exec,  but  the specified command is run from the subdirectory
containing the matched file, which is not normally the directory in
which you started find. This a much more secure method for invoking
commands, as it avoids race conditions during resolution of the paths to
the  matched  files.
....

Gali naudot ir '+' bet tuomet turėtum jungti tik tuos failus, kurie
matchina subdirektorijos viduje.

find /tmp -name core -type f -print0 | xargs -0 /bin/rm -f
^^^
Šis examplas geriausiai iliustruoja, kaip apeiti tarpus, viengubas ar
dvigubas kabutes failų ir/arba direktorijų pavadinimuose.
--
Pagarbiai,