]> scripts.mit.edu Git - autoinstalls/phpBB.git/blob - contrib/fixfiles.sh
phpBB 2.0.19
[autoinstalls/phpBB.git] / contrib / fixfiles.sh
1 #!/bin/bash
2
3 # Remove all those annoying ^M characters that Winblows editor's like to add
4 # from all files in the current directory and all subdirectories.
5 #
6 # Written by: Jonathan Haase.
7 #
8 # UPDATE: 7/31/2001: fix so that it doesn't touch things in the images directory
9 #
10 # UPDATE: 12/15/2003: Fix so that it doesn't touch any "non-text" files
11 #
12
13 find . > FILELIST.$$
14 grep -sv FILELIST FILELIST.$$ > FILELIST2.$$
15 grep -sv $(basename $0) FILELIST2.$$ > FILELIST.$$
16 grep -sv "^\.$" FILELIST.$$ > FILELIST2.$$
17 file -f FILELIST2.$$  |grep text | sed -e 's/^\([^\:]*\)\:.*$/\1/' > FILELIST
18 file -f FILELIST2.$$  |grep -sv text | sed -e 's/^\([^\:]*\)\:.*$/Not Modifying file: \1/'
19 rm FILELIST2.$$
20 rm FILELIST.$$
21
22 for i in $(cat FILELIST); do
23         if [ -f $i ]; then       
24                 sed -e s/\r//g $i > $i.tmp
25                 mv $i.tmp $i
26         fi      
27 done
28 rm FILELIST