How to compare the content of a tarball with a folder

前端 未结 5 1383
旧时难觅i
旧时难觅i 2021-02-05 04:44

How can I compare a tar file (already compressed) of the original folder with the original folder?

First I created archive file using

tar -         


        
5条回答
  •  说谎
    说谎 (楼主)
    2021-02-05 05:39

    I recently needed a better compare than what "tar --diff" produced so I made this short script:

    #!/bin/bash
    tar tf "$1" | while read ; do 
      if [ "${REPLY%/}" = "$REPLY" ] ; then 
        tar xOf "$1" "$REPLY" | diff -u - "$REPLY" 
      fi
    done
    

提交回复
热议问题