On Thu, Sep 04, 2003 at 08:13:37PM +0200, Juan Quintela wrote:
that it will use much less space. Any "script guru" that can make a
script that given 2 directories, just md5sum files, and if they are
identical, just removes file and makes a symlink?

no need to md5sum files when you can compare them attached script does hardlink, but you can change it.

L.

--
Luca Berra -- [EMAIL PROTECTED]
       Communication Media & Services S.r.l.
/"\
\ /     ASCII RIBBON CAMPAIGN
 X        AGAINST HTML MAIL
/ \
#!/bin/sh
dir1="$1"
dir2="$2"

if [ -z "$dir1" -o -z "$dir2" -o "$dir1" = "$dir2" ]; then
echo ERROR 1>&2
exit 1
fi

if [ "$dir1" = "${dir1#/*}" ]; then
        dir1="$PWD/$dir1"
fi

if [ "$dir2" = "${dir2#/*}" ]; then
        dir2="$PWD/$dir2"
fi

if [ ! -d "$dir1" -o ! -d "$dir2" ]; then
echo ERROR 1>&2
exit 1
fi

cd "$dir1"
find . -type f | while read line; do
        if cmp "$line" "$dir2/$line"; then
                ln -nf "$line" "$dir2/$line"
        fi
done

Reply via email to