为什么 .RAR 文件包含同名的不同文件
我得到一个 .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
为什么?
I got a .RAR file which contains different files with the same name.
For example,
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
Why?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
正如之前所说,这些文件可能位于不同的路径中,但正如我将进一步展示的,情况并非总是如此。
如果您使用 WinRAR 列出文件内容并且您的选项设置如下,那么只会显示您有同名的文件,但它们位于不同的路径中。
在 CRC32 列之后,有一个称为 Path(路径)的列。如果这是不同的,则在以下情况下提取应该不是问题:
如果是不提取路径,由于文件系统限制,WinRAR 将需要要求您重命名它们。
我认为在这种情况下命令行 unrar 不会成为问题,因为您需要指定其他参数来更改其默认行为。
RAR 存档可能在同一目录中包含多个同名文件。如果您使用 Windows,请使用“C:\Program Files\WinRAR\Rar.exe”< /em>
而不是以下示例中命令行上的 rar。
创建一个新文件并将其添加到 RAR 存档中。您还可以通过列出其内容来检查更改。
如果您尝试重新添加此文件,rar 将以相同名称替换已添加的文件。
创建其他文件或重命名第一个文件并将其添加到 RAR 文件中。
将第二个文件重命名为第一个文件的名称。
这就是在同一路径中创建包含多个同名文件的 RAR 文件的方法。这些步骤在 WinRAR 中是类似的。如果您尝试再次重命名该文件,该目录中所有文件的文件名也会更改。
为什么有人想要这样做?
我能想到的唯一解释是创建此存档的人想要模仿版本控制/备份系统。但是,如果您只想提取一个特定版本并且它不是第一个版本,则 WinRAR 会提取错误的文件。看来我发现了一个非常晦涩的 WinRAR bug :-)
编辑:在 RAR 文档中找到这个之后,似乎是一个糟糕的解释:
Like said before, the files could be in separate paths, but as I'll show further, this isn't always the case.
If you use WinRAR to list the file contents and your options are set as the following, then it only appears you have files with the same name, but they are in different paths.
After the column CRC32, there is one called Path. If this is different, extraction shouldn't be a problem if:
If it is Do not extract paths, WinRAR will need to ask you to rename them because of file system limitations.
I assume command line unrar won't be a problem in this case because you need to specify additional parameters to change its default behavior.
It is possible for a RAR archive to have multiple files with the same name in the same directory. If you use Windows, use "C:\Program Files\WinRAR\Rar.exe"
instead of rar on the command line in the following examples.
Create a new file and add it to a RAR archive. You can also check the changes by listing its contents.
If you try to re-add this file, rar will replace the already added file with the same name.
Create an other file or rename the first one and add it to the RAR file.
Rename the second file to the first one's name.
This is how you create a RAR file with multiple files of the same name in the same path. These steps will be similar in WinRAR. If you try to rename the file again, the file name of all files in that directory will change too.
Why would someone want to do this?
The only explanation I can think of is that the person that created this archive wanted to imitate a version control/backup system. But if you want to extract only one specific version and it isn't the first one, WinRAR extracts the wrong file. It seems I've found a very obscure WinRAR bug :-)
Edit: seems a bad explanation after finding this in the RAR documentation:
他们很可能走在不同的道路上。
尝试输出完整路径。或者看看当你提取它们时会发生什么。
你可能会看到类似的东西:
等等
they are in different paths, most likely.
try outputting the full path. or see what happens when you extract them.
you'll probably see something like:
etc etc