如何比较tarball和文件夹的内容 [英] How to compare the content of a tarball with a folder

查看:101
本文介绍了如何比较tarball和文件夹的内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将原始文件夹的 tar 文件(已压缩)与原始文件夹进行比较?

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

首先我使用

tar -kzcvf directory_name.zip directory_name

然后我尝试使用

tar -diff -vf directory_name.zip directory_name

但这没用。

推荐答案

-比较(-d)更为方便。

tar --compare --file=archive-file.tar

$ b如果archive-file.tar在创建目录中,则
$ b

有效。要比较archive-file.tar与远程目标(例如,如果已将archive-file.tar移至/ some / where /),请使用 -C 参数:

works if archive-file.tar is in the directory it was created. To compare archive-file.tar against a remote target (eg if you have moved archive-file.tar to /some/where/) use the -C parameter:

tar --compare --file=archive-file.tar -C /some/where/

如果要查看tar是否有效,请使用 -v 而不使用<$ c $仅报告c> -v 错误(缺少文件/文件夹)。

If you want to see tar working, use -v without -v only errors (missing files/folders) are reported.

提示:此选项适用于压缩的tar.bz/ tar.gz档案。

Tipp: This works with compressed tar.bz/ tar.gz archives, too.

这篇关于如何比较tarball和文件夹的内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆