-
Notifications
You must be signed in to change notification settings - Fork 7
/
find_duplicates.sh
executable file
·30 lines (25 loc) · 1023 Bytes
/
find_duplicates.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/sh
#find duplicates of files named the same
#set a filter for know duplicates we need
FILTER="Makefile CrCmap.c RdBitF.c README sharedlib.c SaveSet.c misc.c Pixmap.c CHANGES Object.h.redundant TextP.h.redundant jump_vars List.c Text.c RectObj.h.redundant jump_funcs Text.h.redundant Tree.c parse.c Image.c Xlib.h Shell.h keysym.h X.h Xauth.h StringDefs.h.deactivated Xdmcp.h Sync.c Misc.c Text16.c Bell.c NextEvent.c Flush.c Display.c Create.c Wrap.c
"
find -type f | grep -v .*\.o > names.lst
#cat names.lst | grep -v .*\.o > names.lst
while read name; do
bn="$( basename "$name" )"
name2="$( grep "$bn"$ names.lst | grep -v "$name" )"
if [ ! "$name2" = "" ]; then
if [ "$(echo $FILTER | grep "$bn")" = "" ]; then
echo "found duplicate"
echo "$name"
echo
echo "$name2"
# lets remove the name2 from names.lst to avoid refinding NOTWORKING
#for X in $(echo $name2); do
#echo dada ${X}
# grep -v "${X}" names.lst > names2.lst
#done
exit
fi
fi
done < names.lst