Change permissions on a folder from the command line (on Mac)

I am trying to write a script that will allow me to add to the existing directory structure and copy a bunch of files to different places inside this. However, using the mkdir ... and cp... commands will not work, since I do not have permission to do this. I understand that this can be changed manually in the "Get Information" window, but this script will be launched by others, and all his attention is to save time and trouble.

Is there a way to add a script to this to give me permission to copy files to BASEDIR / SUBDIRS?

A bit more about what I'm doing:
I want to add BASEDIR to the directory with a bunch of SUBDIRS, and then copy the files to these subdirectories. The problem is that I get these errors โ€œrefusedโ€ right after the mkdir BASEDIR/SUBDIR1/SUBDIR2 .

thanks

+4
source share
1 answer

Command
sudo chmod -R ugo=rwx BASEDIR/
gives all folder permissions to all BASEDIR users and all its subdirectories

+4
source

All Articles