Changing permissions to just files or folders

So I was debugging something on WordPress and because I wanted something to work, I changed the plugin folder to 777. While that didn’t solve my problem, when my problem was fixed later, I needed to undo my change. For WordPress, they recommend the permission 644 to files and 755 to folders. With chmod, there’s really no filter or flag to say just folders or files. Granted, I could go through and manually update each file and folder, but holy cow WordPress has a LOT of both. Thank god for StackOverflow. Found this for post on the forum that saved a lot of time

find <path to folder> -type f -exec chmod 664 {} + -o -type d -exec chmod 775 {} +;

Thanks to this, the plugin folder is no longer open to the world. I had to run this command as sudo but it did exactly what I needed it to do.