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:
16
dirdedupe.sh
16
dirdedupe.sh
@ -78,16 +78,24 @@ do
|
||||
if [ -f "${shadowfile}" ]; then
|
||||
masterfile="${shadowfile/#${shadowdir}/${masterdir}}"
|
||||
if [ -f "${masterfile}" ]; then
|
||||
if [ "${shadowfile}" -ef "${masterfile}" ]; then
|
||||
echo "ID \"${masterfile}\" <-> \"${shadowfile}\""
|
||||
else
|
||||
cmp -s "${masterfile}" "${shadowfile}"
|
||||
if [ $? -eq 0 ]; then
|
||||
if [ $REALLYRUN -gt 0 ]; then
|
||||
echo "Linking \"${masterfile}\" <-- \"${shadowfile}\""
|
||||
echo "LINK \"${masterfile}\" <-- \"${shadowfile}\""
|
||||
ln -Pf "${masterfile}" "${shadowfile}"
|
||||
else
|
||||
echo "NOT linking \"${masterfile}\" <-- \"${shadowfile}\""
|
||||
fi
|
||||
fi
|
||||
echo "HYPO \"${masterfile}\" <~~ \"${shadowfile}\""
|
||||
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
|
||||
done
|
||||
|
||||
|
||||
Reference in New Issue
Block a user