How to avoid thumbs.db files in compression - compression

Is there a 7zip or winzip command to use so that the compression avoids thumbs.db files?

For 7zip,-x is the file exclusion option switch.
7z.exe a test.7z C:test* -r -x!thumbs.db
See Excluding Files at the following link.

Related

compress list of files and directories with brotli

I'd like to use brotli to compress a list of files and directories. I'm able to do this with zip running
zip -r archive.zip *
and I'm looking for a similar command with brotli. I've tried
tar -cf archive.gz * && \
brotli -n -q 11 -o archive.zip archive.gz
but after decompression the zip doesn't have the same structure than with zip.
Your second command is actually right. Brotli, like Gzip/Bzip2/etc can only compress a single file.
What you must do is first package all of your files in a tarball:
tar -cvf output.tar /path/to/dir
And then compress the resulting tarball with Brotli:
brotli -j -Z output.tar
Which should leave you with a output.tar.br file (similar to *.tar.gz gzipped tarballs).
Have you tried Brotli-cli?
This comes with a lot of options to get files compressed using Brotli
you can try creating a .tar file instead of .gz

Regex to add an extension to a directory full of files

I am new to regular expressions.
I have many irregularly numbered ascii files with no extension: g000554, g000556, g000558, g000561, g000563 ... g001979 etc
I would like to type a regex at the terminal (or in a short script) to add a .dat to all of these files.
So I would like to change them to become: g000554.dat, g000556.dat, g000558.dat, g000561.dat, g000563.dat ... g001979.dat etc
p.s. Sorry I should have provided more info: by terminal I meant a mac terminal and I cannot use the 'rename' command.
I think you're using a linux system. So i provide a bash solution. It works only if your files starts with g and there is no other files in that directory except the files you want to rename.
for i in g*; do mv "$i" "$i.dat"; done
The below would add .dat extension to all the files present in the current directory,
for i in *; do mv "$i" "$i.dat"; done

how to decompress with pigz

I am trying to use pigz for parallel compress and decompress. I have found a way to compress in parallel using the following command:
tar cf - /input/dir | pigz > output_file.tar.gz
What is the equivalent command to decompress? I need to be able to specify the filename and the output directory path in the command for it to be useful for me.
Use pigz -dc for decompression to stdout. Then use > as you are in your example to direct the output to the desired path and file.
You can type just pigz for command options help.
You're probably looking for something along the lines of:
pigz -dc archive.tar.gz | tar xf -
but noting Mark Adler's (legendary, at this point) original post, pigz does not utilize multiple cores for decompression. However, it does utilize additional cores for reading, writing, and some additional calculations, which do yield a moderate performance increase over gzip. Enjoy!
tar -I pigz -xvf compressed_file.tar.gz
For some reason, pigz doesn't autocomplete ".gz" compressed files, but if you type the names of your files pigz finds them.
To decompress and keep your compressed files use: pigz -dk yourfilename.gz.
If you don't need the compressed versions use just pigz -d yourfilename.gz.
pigz --help shows all the options available.

Good free lib for compression

I need compress library for following needs:
1) Packing directory in one file with extension of my choice ( .pack for example )
2) Work with content in this file (directory) without unpaking it
3) Mechanism for encrypting
I already know about zlib, but for me it is ugly documented and not written anywhere what features are support from it
Packing directory in one file with extension of my choice ( .pack for example )
Most archivers don't require you to use a particular file extension. Regardless, one can still invoke file on a file to guess its content type.
Work with content in this file (directory) without unpaking it
It's possible to create a file list manually and prepend any archive file with that. Often, .sh installers for Linux contain a shell script in the beginning, followed by some magic line like __ARCHIVE_START__ followed by a binary archive. Hence it is possible to read lines from a file until __ARCHIVE_START__ line has been read. The rest of the file is an archive file.
Mechanism for encrypting
One easy way is to use different libraries for archiving and encrypting:
Bundle the files into one .tar.
Archive .tar into say .tar.xz.
Prepend the .tar.xz with file list followed by __ARCHIVE_START__ line.
Encrypt the file with any encryption library you please.
What you want is not a compression library. You want a compression, archiving, and encryption library or libraries. You need archiving to put a directory of files into a single file.
You can use zlib to do the compress part, but not archive or encrypt. zlib is documented in zlib.h and you can see a usage example there, as well as many examples in the source distribution package.
You can construct your own archiving format, or you can use existing ones for which there are libraries such as zip or tar, both of which use or can be directed to use zlib.
You can use OpenSSL for strong encryption.

7zip file compression mode store using command prompt is not working?

I need to compress my data folder using 7zip (compression mode store) from my nant script. If I compressed from command prompt its not working properly. It taking some other compression mode.
This is my code
7zip.exe a mydatafolder.7z -ptest -mx0 mytarget
Please help me.
Thanks
Which version of 7zip.exe?
Which compression mode is used in the existing 7z file?
Can you attach\link to a sample 7z archive that you have tried and behaves unexpectedly when trying to add another file without compression?
I am not sure if you can use mixed compression mode in a 7z archive or not.