Zstd: Exclude certain files

Created on 10 Apr 2019  路  3Comments  路  Source: facebook/zstd

Dear @facebook,
Imagine there is the following files tree, which is growing day by day.

C:\Logs
|-- 2019-04-08
|   `-- log01.txt
|-- 2019-04-09
|   `-- log02.txt
`-- 2019-04-10
    `-- log03.txt

To reduce the footprint, I command zstd --long --rm -r C:\Logs
then big .txt are replaced with small .txt.zst, so far so good.
But tomorrow the tree will obviously look like this

|-- 2019-04-08
|   `-- log01.txt.zst
|-- 2019-04-09
|   `-- log02.txt.zst
|-- 2019-04-10
|   `-- log03.txt.zst
`-- 2019-04-11
    `-- log04.txt

_And here lies the crux as the aforementioned command will compress existing_ .txt.zst _again._

Current workaround is find -type f -not -iname *.zst -exec zstd --long --rm {} +
or by means of fd by @sharkdp as follows fd -t f --exclude *.zst -x zstd --long --rm

However, some native exclude switch would be appropriate and appreciated,
e.g. zstd --exclude *.zst --long --rm -r C:\Logs

Do you agree?

feature request

Most helpful comment

I don't want to add glob match finding support to zstd. However a --exclude-suffix .zst or maybe --exclude-compressed which would ignore (.zst|.gz|.xz|.lz4|...) would be a useful feature.

All 3 comments

I don't want to add glob match finding support to zstd. However a --exclude-suffix .zst or maybe --exclude-compressed which would ignore (.zst|.gz|.xz|.lz4|...) would be a useful feature.

T56236104 (internal note)

--exclude-compressed has been added to v1.4.4.

Was this page helpful?
0 / 5 - 0 ratings