man chmod
at the command line will answer your question,
but for brevity,
cd public_html/dir1
chmod 777 *
will only change all files in dir1 to 777
cd public_html/dir1
chmod -R *
will change all files in dir1 too 777, but additionally change recursively all the directories and their contents within dir1 - ie all the contents of dir2 and dir3 etc etc