有人知道如何比较 archiwum.rar 中的文件数量和文件大小及其在文件夹中提取的内容吗?
我想这样做的原因是,我正在使用的服务器在提取过程中已重新启动几次,我不确定是否所有文件都已正确提取。
.rar 文件每个都超过 100GB,服务器速度不是那么快。
有什么想法吗?
ps。如果解决方案是一些代码而不是独立程序,我更喜欢 Python。
谢谢
最佳答案
在Python中你可以使用RarFile模块。使用方法与内置模块ZipFile类似.
import rarfile
import os.path
extracted_dir_name = "samples/sample" # Directory with extracted files
file = rarfile.RarFile("samples/sample.rar", "r")
# list file information
for info in file.infolist():
print info.filename, info.date_time, info.file_size
# Compare with extracted file here
extracted_file = os.path.join(extracted_dir_name, info.filename)
if info.file_size != os.path.getsize(extracted_file):
print "Different size!"
关于python - 在 Windows 7 上比较 archiwum.rar 内容和从文件夹中的 .rar 中提取的数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9410847/