我有一个 .RAR 文件,其中包含同名的不同文件。
例如,
index.txt 40 Text Document 04/01/2010 4:40PM
index.txt 22 Text Document 04/01/2010 4:42PM
index.txt 10 Text Document 04/01/2010 4:45PM
index.txt 13 Text Document 04/01/2010 4:50PM
为什么?
我有一个 .RAR 文件,其中包含同名的不同文件。
例如,
index.txt 40 Text Document 04/01/2010 4:40PM
index.txt 22 Text Document 04/01/2010 4:42PM
index.txt 10 Text Document 04/01/2010 4:45PM
index.txt 13 Text Document 04/01/2010 4:50PM
为什么?
如前所述,这些文件可能位于不同的路径中,但正如我将进一步展示的那样,情况并非总是如此。
如果您使用 WinRAR 列出文件内容并且您的选项设置如下,那么它只会显示您有同名的文件,但它们位于不同的路径中。
在 CRC32 列之后,有一个称为 Path。如果这是不同的,提取不应该是一个问题,如果:
如果是Do not extract paths,由于文件系统的限制,WinRAR 会要求你重命名它们。我假设命令行 unrar 在这种情况下不会成为问题,因为您需要指定其他参数来更改其默认行为。
RAR 压缩文件可能在同一目录中有多个同名文件。如果您使用 Windows,请在以下示例的命令行中使用“C:\Program Files\WinRAR\Rar.exe” 而不是rar 。
创建一个新文件并将其添加到 RAR 存档中。您还可以通过列出其内容来检查更改。
rar a rarfile.rar testfile.txt
rar l rarfile.rar
rar a rarfile.rar testfile.txt
如果您尝试重新添加此文件,rar 将替换已添加的同名文件。
Updating archive rarfile.rar
Updating testfile.txt OK
Done
创建另一个文件或重命名第一个文件并将其添加到 RAR 文件中。
move testfile.txt second.txt (new file)
rar a rarfile.rar second.txt (add it)
rar lb rarfile.rar (list archive, bare info)
将第二个文件重命名为第一个文件的名称。
rar rn rarfile.rar second.txt testfile.txt
这就是您如何在同一路径中创建具有多个同名文件的 RAR 文件。这些步骤在 WinRAR 中是类似的。如果您再次尝试重命名文件,该目录中所有文件的文件名也会更改。
为什么有人要这样做?
我能想到的唯一解释是创建这个档案的人想模仿一个版本控制/备份系统。但是,如果您只想提取一个特定版本而不是第一个,WinRAR 会提取错误的文件。看来我发现了一个非常模糊的 WinRAR 错误 :-)
编辑:在 RAR 文档中找到这个后似乎是一个不好的解释:
-ver[n] File version control Forces RAR to keep previous file versions when updating files in the already existing archive. Old versions are renamed to 'filename;n', where 'n' is the version number. By default, when unpacking an archive without the switch -ver, RAR extracts only the last added file version, the name of which does not include a numeric suffix. But if you specify a file name exactly, including a version, it will be also unpacked. For example, 'rar x arcname' will unpack only last versions, when 'rar x arcname file.txt;5' will unpack 'file.txt;5', if it is present in the archive. If you specify -ver switch without a parameter when unpacking, RAR will extract all versions of all files that match the entered file mask. In this case a version number is not removed from unpacked file names. You may also extract a concrete file version specifying its number as -ver parameter. It will tell RAR to unpack only this version and remove a version number from file names. For example, 'rar x -ver5 arcname' will unpack only 5th file versions. If you specify 'n' parameter when archiving, it will limit the maximum number of file versions stored in the archive. Old file versions exceeding this threshold will be removed.
他们很可能处于不同的路径。
尝试输出完整路径。或者看看提取它们时会发生什么。
你可能会看到类似的东西:
index.txt
path1/index.txt
path2/index.txt
等等等等