Don't re-link already linked files, UI enhanced

While creating hard links, check if they're already linked first.
    This saves SUBSTANTIAL time in Time Machine directories where many
    files are already hard links.

    Also, be clearer when running about what exactly it is we're doing
    with each file.
This commit is contained in:
Lee Ockert
2023-10-18 18:29:20 -04:00
parent bf39b320b9
commit efdf9717db

View File

@ -78,16 +78,24 @@ do
if [ -f "${shadowfile}" ]; then if [ -f "${shadowfile}" ]; then
masterfile="${shadowfile/#${shadowdir}/${masterdir}}" masterfile="${shadowfile/#${shadowdir}/${masterdir}}"
if [ -f "${masterfile}" ]; then if [ -f "${masterfile}" ]; then
if [ "${shadowfile}" -ef "${masterfile}" ]; then
echo "ID \"${masterfile}\" <-> \"${shadowfile}\""
else
cmp -s "${masterfile}" "${shadowfile}" cmp -s "${masterfile}" "${shadowfile}"
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
if [ $REALLYRUN -gt 0 ]; then if [ $REALLYRUN -gt 0 ]; then
echo "Linking \"${masterfile}\" <-- \"${shadowfile}\"" echo "LINK \"${masterfile}\" <-- \"${shadowfile}\""
ln -Pf "${masterfile}" "${shadowfile}" ln -Pf "${masterfile}" "${shadowfile}"
else else
echo "NOT linking \"${masterfile}\" <-- \"${shadowfile}\"" echo "HYPO \"${masterfile}\" <~~ \"${shadowfile}\""
fi
fi
fi fi
else
echo "MOD \"${masterfile}\" <X> \"${shadowfile}\""
fi # end check for file equality
fi # end check for inode equality
else
echo "NEW \"${shadowfile}\" "
fi # end check if master file exists
fi fi
done done