phpBB
Statistics
| Revision:

root / branches / phpBB-3_0_0 / phpBB / develop / fix_files.sh

History | View | Annotate | Download (867 Bytes)

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 | grep -v icon_textbox_search.gif | 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
		cat $i | tr -d '\r' > $i.tmp
25
		mv $i.tmp $i
26
	fi	
27
done
28
rm FILELIST
29