【发布时间】:2014-07-11 17:32:28
【问题描述】:
我有一个简单的 bash 脚本,可以解压缩一个目录中的一堆文件:
#!/bin/bash
dir=/volatile/huanlab/bold/kendal/bioinformatics_database/tmp/compound
gunzip -f $dir/*gz*
但是当我运行这个命令时,我得到了这些错误:
gzip: /volatile/huanlab/bold/kendal/bioinformatics_database/tmp/compound/Compound_012650001_012675000.sdf.gz: No such file or directory
gzip: /volatile/huanlab/bold/kendal/bioinformatics_database/tmp/compound/Compound_012675001_012700000.sdf.gz: No such file or directory
gzip: /volatile/huanlab/bold/kendal/bioinformatics_database/tmp/compound/Compound_012700001_012725000.sdf.gz: No such file or directory
gzip: /volatile/huanlab/bold/kendal/bioinformatics_database/tmp/compound/Compound_012725001_012750000.sdf.gz: No such file or directory
... [this continues on for every file in the directory]
显然它正在查找目录中的每个文件,因为文件名列在错误中,但随后它无法解压缩并说找不到文件。这是怎么回事?
编辑有些文件确实被解压了,但仍然显示该文件的错误
【问题讨论】:
-
/volatile/huanlab/bold/kendal/bioinformatics_database/tmp/compound/Compound_012725001_012750000.sdf.gz可以作为链接吗? -
不,这些都是我手动放入目录的文件。
-
介意检查这些文件是否真的具有可读权限?
[[ -r /volatile/huanlab/bold/kendal/bioinformatics_database/tmp/compound/Compound_012700001_012725000.sdf.gz ]] && echo readable -
这里是
ls -al在该目录-r--r--r-- 1 kharland jhuangroup 5609 Jul 6 15:30 Compound_009525001_009550000.sdf.gz上的输出,所有文件都具有这些确切的权限。有趣的建议,我没想过这样做。我也刚刚意识到你给了我一个命令,输出结果是空的 -
我可以猜到这是某个地方的错误。如果不在 gunzip 中,它可能在其中一个库中。如果您改用
gzip -d /path/to/file.gz会有所不同吗?我很好奇你的 gzip 版本:gzip --version。