#!/bin/sh tmp=/tmp/validate-$$ mkdir "$tmp" sort <<-. >"$tmp/wanted" Orange Apple Plum . for dir in "$@" do find "$dir" -maxdepth 1 -type d -not -name . -printf '%f\n' | sort >"$tmp/found" comm -2 -3 "$tmp/wanted" "$tmp/found" | sed "s!.*!Missing dir: $dir/&!" comm -1 -3 "$tmp/wanted" "$tmp/found" | sed "s!.*!Extra dir: $dir/&!" find "$dir" -maxdepth 1 -type f -printf "Extra file: $dir/%f\n" find "$dir" -type f -name '* *' -printf "Space in name: $dir/%f\n" find "$dir" -type f -name '*[A-Z]*' -printf "Uppercase in name: $dir/%f\n" find "$dir" -type f -not -name '*.png' -not -name '*.psd' -printf "Bad extension: $dir/%f\n" done rm -r "$tmp"
#!/bin/sh tmp=/tmp/validate-$$ mkdir "$tmp" sort <<-. >"$tmp/wanted" Orange Apple Plum . for dir in "$@" do find "$dir" -mindepth 1 -maxdepth 1 -type d -not -name . -printf '%f\n' | sort >"$tmp/found" comm -2 -3 "$tmp/wanted" "$tmp/found" | sed "s!.*!Missing dir: $dir/&!" comm -1 -3 "$tmp/wanted" "$tmp/found" | sed "s!.*!Extra dir: $dir/&!" find "$dir" -maxdepth 1 -type f -printf 'Extra file: %p\n' find "$dir" -type f -name '* *' -printf 'Space in name: %p\n' find "$dir" -type f -name '*[A-Z]*' -printf 'Uppercase in name: %p\n' find "$dir" -type f -not -name '*.png' -not -name '*.psd' -printf 'Bad extension: %p\n' done rm -r "$tmp"
posted by clearlydemon at 7:08 PM on May 1, 2011