Untar * .tar.bz2在Windows命令行上使用7-zip

时间:2012-06-22 18:43:32

标签: windows powershell windows-7 7zip cppunit

我在powershell脚本中有一个函数,它应该解压我的CppUnit.tar.bz2文件。我已经安装了7-zip,在我的功能中我有以下内容:

Function untar ($targetFile) {        
        $z ="7z.exe"

        $defaultDestinationFolder = 'C:\Program Files\'
        $destinationFolder = (Get-Item $defaultDesitantionFolder).fullname

        $tarbz2Source = $targetFile
        & "$z" x -y $tarbz2Source

        $tarSource = (get-item $targetFile).basename
        & "$z" x -y $tarSource -o $destinationFolder

        Remove-Item $tarSource
}

运行它会提取我想要的所有文件,但是所有文件都以“,v”结尾:

...
Extracting  cppunit-cvs-repo-archive\cppunit\cppunit\Attic
Extracting  cppunit-cvs-repo-archive\cppunit\cppunit\Attic\estring.h,v
Extracting  cppunit-cvs-repo-archive\cppunit\cppunit\Attic\TestSuite.h,v
Extracting  cppunit-cvs-repo-archive\cppunit\cppunit\Attic\Test.h,v
Extracting  cppunit-cvs-repo-archive\cppunit\cppunit\Attic\TestCase.h,v
Extracting  cppunit-cvs-repo-archive\cppunit\cppunit\Attic\TextTestResult.h,v
Extracting  cppunit-cvs-repo-archive\cppunit\cppunit\Attic\Makefile.am,v
Extracting  cppunit-cvs-repo-archive\cppunit\cppunit\Attic\TestSuite.cpp,v
Extracting  cppunit-cvs-repo-archive\cppunit\cppunit\Attic\Exception.cpp,v
Extracting  cppunit-cvs-repo-archive\cppunit\cppunit\Attic\cppunit.dsw,v
Extracting  cppunit-cvs-repo-archive\cppunit\cppunit\Attic\TestFailure.h,v
Extracting  cppunit-cvs-repo-archive\cppunit\cppunit\Attic\TestCaller.h,v
Extracting  cppunit-cvs-repo-archive\cppunit\cppunit\Attic\TestResult.h,v
Extracting  cppunit-cvs-repo-archive\cppunit\cppunit\Attic\TextTestResult.cpp,v
Extracting  cppunit-cvs-repo-archive\cppunit\cppunit\Attic\TestRegistry.h,v
Extracting  cppunit-cvs-repo-archive\cppunit\cppunit\Attic\TestFailure.cpp,v
Extracting  cppunit-cvs-repo-archive\cppunit\cppunit\Attic\Exception.h,v
Extracting  cppunit-cvs-repo-archive\cppunit\cppunit\Attic\TestRegistry.cpp,v
Extracting  cppunit-cvs-repo-archive\cppunit\cppunit\Attic\cppunit.dsp,v
Extracting  cppunit-cvs-repo-archive\cppunit\cppunit\Attic\TestResult.cpp,v
Extracting  cppunit-cvs-repo-archive\cppunit\cppunit\Attic\TestCase.cpp,v

Everything is Ok

Folders: 149
Files: 1128
Size:       20671974
Compressed: 21626880

有谁能告诉我如何解决这个问题?

1 个答案:

答案 0 :(得分:4)

,v后缀表示这些不是文件本身,而是由CVS维护的版本历史文件 - 每个,v文件不仅包含文件的最新版本,还包含重建任何文件的增量该文件的先前版本。它们都在Attic子目录中的事实表明它们在某些时候都是通过cvs remove删除的。这些以及基本目录为cppunit-cvs-repo-archive的事实表明您需要将解压缩的存档视为CVS存储库,并使用适当的工具检出您要使用的文件,而不仅仅是“修复”看起来像什么喜欢错误的名字......