#!/usr/bin/php -q SYNOPSIS php fixlineends.php [options] PATH [PATH2...] DESCRIPTION Traverse recursively all the paths given and fix line endings in each file. OPTIONS --eofnewline force new line character at the end of file --eofstripwhite strip whitespace from the end of file --eolstripwhite strip whitespace from the end of line (spaces, tabs) --excluderegex=regex use regex to exclude files, preg_match() format expected --help display this help and exit --noarchive if set to true, archive files are skipped (Windows only) --nodotfiles if set to true, dot files are skipped --nohidden if set to true, hidden files are skipped (Windows only) --nosystem if set to true, system files are skipped (Windows only) --maxdepth fix line ends only if file is N or fewer levels below the command line argument; Use --max-depth=0 to omit subdirectories EXAMPLES php fixlineends.php --eofstripwhite --eofnewline --maxdepth=1 --nodotfiles --excluderegex=/\_private/ . This command fixes line endings in current directory and in subdirectories placed one level below. Dot files are skipped. Paths that match "_private" are skipped. White chars are stripped at the end of file. New line character is added to the end of file (if required).