I am working on a small cli in rust and I would like to create a tgz file from a directory. I would like to exclude some files and directories from it though. For example I would like to exclude any .custom files from any directories.
I ended up using tar and workdir crates but somehow code I end up with seems very complicated … Also, seems tar crate doesn’t support excluding files or directories as the cli does.
So what I do is using workdir to loop over all files in the directory, filtering files I want to exclude and add one by one file in the archive.
Is there a magic way of doing it simply?
Thanks a lot !