Make writable recursively for owner

published Nov 11, 2008, last modified Jul 17, 2020

#!/bin/sh

#Make writable recursively for owner
#by Manuel Amador (Rudd-O)
#under the GPL

#you need to configure /etc/sudoers for this to work at all
# put this in your /etc/sudoers:
#your_username ALL = NOPASSWD: /bin/chown
#(obviously, without the hash mark at the beginning of the line, and replacing your_username with your actual user name)

quoted=$(echo -e "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" | awk 'BEGIN { FS = "\n" } { printf "\"%s\" ", $1 }' | sed -e s#\"\"##)

eval "sudo /bin/chmod -R u+rwX $quoted"