3 #==============================================================================
5 # File ID: 6fc9b9b8-5d43-11df-ab40-90e6ba3022ac
6 # Compares the files in directory $1 with existing files in directory $2
7 # and removes the duplicates in directory $2.
8 #==============================================================================
11 echo $0: Invalid number of operands \
($#\
), shall be two.
>&2
15 if [ ! -d "$1" ]; then
16 echo $0: Operand
1 \
($1\
) is not a directory
>$2
20 if [ ! -d "$2" ]; then
21 echo $0: Operand
2 \
($2\
) is not a directory
>&2
25 # BUG: Has to check that $1 and $2 are different dirs. Now it checks inode
26 # on every file, it might skip files if they has the same link, but better
29 # Also... Files with weird names (spaces etc) could have unwanted results.
30 # A check should be done for things like that. Later.
32 # Future check for weird names
33 # find $1 $2 | grep -e ' ' -e '\t' -e ';' -e '&' -e '|' || { echo farsken; exit 1; }
38 _qqr2
="$2/`basename $_qqrc`"
39 if [ -f "$_qqrc" -a -f "$_qqr2" ]; then
40 if [ "$_qqrc" -ef "$_qqr2" ]; then
41 echo $0: File
$_qqrc and
$_qqr2 are the same
>&2
43 diff -q "$_qqrc" "$_qqr2" >/dev
/null
47 echo $_qqrc og
$_qqr2 are not equal