phpBB
Statistics
| Revision:

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

History | View | Annotate | Download (867 Bytes)

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