#! /bin/sh # replace spaces with underscores, lowercase everything, ditch multiple underscores, and ditch _.foo. # should probably try to avoid overwriting existing files, but c'est la vie! rename 's/\s+/\_/g; $_ = lc($_); s/\_+/\_/g; s/\_\././' "$@"