diff options
Diffstat (limited to 'backupStatistics.in')
-rw-r--r-- | backupStatistics.in | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/backupStatistics.in b/backupStatistics.in index 8865af5..aa9b92b 100644 --- a/backupStatistics.in +++ b/backupStatistics.in @@ -28,8 +28,7 @@ do_stage() for dat in $(ls "${dest}") do echo "${dat}:" - find "${dest}/${dat}" -type f -exec \ - stat -c'%i %n' {} \; >> \ + find "${dest}/${dat}" -type f -links -64001 -printf '%i %p\n' >> \ "${cacheDir}/${backupID}.inodes" done ;; @@ -56,14 +55,14 @@ do_stage() 3) if [ "$2" == '##DESCRIBE##' ] then - echo 'generate lists $inode -> $contentHash' + echo 'generate lists $inode -> $count, $contentHash' return 0 fi cat "${cacheDir}/${backupID}.inodes.sorted/"part.* | \ - uniq -m1 | \ + uniq -cm1 | \ parallel \ - sha512sum {=s/^[[:digit:]]\+ //=} \| \ - sed "\"s|^\([0-9a-f]\{128\}\) .*\$|\1 "{=s/^\([[:digit:]]\+\) .*/\\1/=}"|\"" \ + sha512sum {=s/^ *\([[:digit:]]\+ \)\{2\}//=} \| \ + sed '"s|^\([0-9a-f]\{128\}\) .*\$|\1 '{=s/^ *\([[:digit:]]\+ [[:digit:]]\+\) .*/\\1/=}'|"' \ \; > \ "${cacheDir}/${backupID}.content" ;; @@ -75,7 +74,7 @@ do_stage() fi tmpDirA="$(mktemp -d)" tmpDirB="$(mktemp -d "${cacheDir}/tmp.XXXXXX")" - sort -T "${tmpDirA}" -T "${tmpDirB}" "${cacheDir}/${backupID}.content" > \ + sort -T "${tmpDirA}" -T "${tmpDirB}" -k1,1 -k2nr,2 "${cacheDir}/${backupID}.content" > \ "${cacheDir}/${backupID}.content.sorted" rmdir "${tmpDirA}" "${tmpDirB}" ;; @@ -89,7 +88,7 @@ do_stage() uniq -m1 --all-repeated=separate "${cacheDir}/${backupID}.content.sorted" echo "" ) | \ - sed 's|^\S\+ ||' | \ + sed 's|^\(\S\+ \)\{2\}||' | \ while read s do if [ -z "${s}" ] |