#!/bin/sh # first, the folders find . -type d -print | while read i do chmod 0755 $i done # now, the files find . -type f -print | while read i do chmod 0644 $i done # a variation using ls(1) could also have been employed