Saturday, May 16, 2009

chmod list of dirs (or files)

I have list of dirs (generated by some find statement) that we want to grant rights to execute (go inside dir).

the problem with

# cat list | xargs chmod 
intuitive one-line script is that it is not working.

Directories names in list contain spaces and ' " symbols and we have errors in directories processing doing that way.

Added slashes to get working script to grant rights to the files:

# cat list | sed 's/[\ '"'"'"]/\\&/g' | xargs chmod a+x

No comments: