#!/bin/sh
# Convert a list of files from Windows newslines to Unix newlines
# Invoke this script with:  find . -type f | xargs dos2unix-all-files
for filename in "$@" ; do
    # extract filename only (no path)
    shortname="${filename##*/}"
    # for all files (not directories) (and not this script itself)
    if [ -f "$filename" -a "$shortname" != "dos2unix-all-files" ]; then
        # translate from Windows newlines to Unix newlines in-place
        dos2unix -q "$filename"
    fi
done
