我有一个输入bz2文件的文件夹,其中一些文件可能已损坏,在运行MR作业之前,我希望删除所有已损坏/无效的bz2文件。什么是好的方法?
发布于 2013-10-24 03:05:50
使用bzip2 -t测试bzip文件是否损坏。如果它被腐蚀了,我想你可以看到这样的东西。
bzip2: test1.txt: bad magic number (file not created by bzip2)
bzip2: 2: bad magic number (file not created by bzip2)
You can use the `bzip2recover' program to attempt to recover
data from undamaged sections of corrupted files.因此,如果您的文件位于本地文件系统中,那么使用基于上述要点的shell脚本就可以了。如果您的文件已经在HDFS上,那么使用带有映射器的Hadoop流作为脚本输出损坏的文件,而没有还原器,或者使用还原器删除或发布这些文件。
https://stackoverflow.com/questions/19551566
复制相似问题