tar: file changed as we read it

前端 未结 8 1987
你的背包
你的背包 2020-12-02 15:03

I am using make and tar to backup. When executing makefile, tar command shows file changed as we read it. In this case,

8条回答
  •  鱼传尺愫
    2020-12-02 15:36

    Although its very late but I recently had the same issue.

    Issue is because dir . is changing as xyz.tar.gz is created after running the command. There are two solutions:

    Solution 1: tar will not mind if the archive is created in any directory inside .. There can be reasons why can't create the archive outside the work space. Worked around it by creating a temporary directory for putting the archive as:

    mkdir artefacts
    tar -zcvf artefacts/archive.tar.gz --exclude=./artefacts .
    echo $?
    0
    

    Solution 2: This one I like. create the archive file before running tar:

    touch archive.tar.gz
    tar --exclude=archive.tar.gz -zcvf archive.tar.gz .
    echo $?
    0
    

提交回复
热议问题