我有一个目录。它具有大约500K .gz文件。
如何提取该目录中的所有.gz文件并删除.gz文件?
我有一个目录。它具有大约500K .gz文件。
如何提取该目录中的所有.gz文件并删除.gz文件?
Answers:
应该这样做:
gunzip *.gz
find "$dir" -maxdepth 1 -name '*.gz' -print0 | xjobs -0 -l50 -v2  gunzip方法将实例限制为每个参数50个(并并行运行)。
                    显然,有多种方法可以做到这一点。
    # This will find files recursively (you can limit it by using some 'find' parameters. 
    # see the man pages
    # Final backslash required for exec example to work
    find . -name '*.gz' -exec gunzip '{}' \;
    # This will do it only in the current directory
    for a in *.gz; do gunzip $a; done
我敢肯定还有其他方法,但这可能是最简单的方法。
并将其删除,只需rm -rf *.gz在适用的目录中执行
.gz文件不一定是归档。在这种情况下,演奏时您将没有任何要删除的内容gzip -d file.gz。