Gzip multiple files individually and keep the original files

后端 未结 4 817
自闭症患者
自闭症患者 2021-02-02 17:47

I am looking to gzip multiple files (into multiple .gz files) in a directory while keeping the originals.

I can do individual files using these commands:



        
4条回答
  •  广开言路
    2021-02-02 18:41

    -k, --keep

    gzip 1.6 (June 2013) added the -k, --keep option, so now you can:

    find . -type f -name "*cache.html" -exec gzip -k {} \;
    gzip -k *cache.html
    

    or for all files recursively simply:

    gzip -kr .
    

    Found at: https://unix.stackexchange.com/questions/46786/how-to-tell-gzip-to-keep-original-file

提交回复
热议问题