Here is how i run dos2unix recursively on all files:
find -exec dos2unix {} \;
What do i need to change to make it skip over files under .svn/ directories?
Actual tested solution:
$ find . -type f \! -path \*/\.svn/\* -exec dos2unix {} \;
Here's a general script on which you can change the last line as required. I've taken the technique from my findrepo script:
repodirs=".git .svn CVS .hg .bzr _darcs"
for dir in $repodirs; do
repo_ign="$repo_ign${repo_ign+" -o "}-name $dir"
done
find \( -type d -a \( $repo_ign \) \) -prune -o \
\( -type f -print0 \) |
xargs -r0 \
dos2unix
Just offering an additional tip: piping the result through xargs instead of using find's -exec option will increase the performance when going through a large directory structure if the filtering program accepts multiple arguments, as this will reduce the number of fork()'s, so:
find <opts> | xargs dos2unix
One caveat: piping through xargs will fail horribly if any filenames include whitespace.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With