Directory with correct permissions is not writable
Write permission could be blocked by file/folder modes, user flags, non-ownership, Access Control Lists (ACLs) and/or extended attributes.  Below are some commands which can fix these types of errors.


  Note: I assume my_folder does not contain any symbolic links. If there are symbolic links, then these commands may need to be modified.


You can recursively change the folders mode to 755 (drwxr-xr-x) by using the command given below.

find my_folder -type d -execdir chmod 755 {} \;


You can recursively change the regular files mode to 644 (-rw-r--r--) by using the command given below.

find my_folder -type f -execdir chmod 644 {} \;


You can recursively remove user flags by using the command given below.

sudo chflags -R nouchg,nohidden,noopaque,dump,nouappnd my_folder


You can recursively change user ownership of the files and folders by using the command given below.

sudo chown -R $USER my_folder


You can recursively change the group of the files and folders to staff by using the command given below. 

sudo chgrp -R staff my_folder


You can recursively remove any Access Control Lists (ACLs) by using the command given below.

chmod -RN my_folder


You can recursively remove any extended attributes by using the command given below.

xattr -rc my_folder


Often searching for locked files and/or folders can be useful. Below is a command for this.

find my_folder -flags +uchg -exec ls -dF {} \;