How do I improve this function efficiency so that it only searches once instead of three times:
# Fixes permissions for files and directories in the given folder or the current folder
fixperms() {
find "${1:-.}" -type f -executable -exec chmod 744 {} \;
find "${1:-.}" -type f ! -executable -exec chmod 644 {} \;
find "${1:-.}" -type d -exec chmod 755 {} \;
}
IDK exactly what you’re trying to do, but you can use
chmod -r ugo+rw
to add read+write permissions for everyone for all files in a folder recursively.Sometimes when you copy a directory the folder permissions get messed up. I’m trying to make a function to fix the permissions so the files and folders don’t allow writing or executing to anyone other than yourself.