Say I have 1 main folder and 10 sub-folders, each with .avi, .html ,.txt and .srt in them.
Now I want to preserve the folder structure but I want to only compress the .srt files into .7zip.
Is there a command for that?
set path=%path%;C:\Program Files\7-Zip 7z a archive.7z -ir!MainFolder\*.srt
reference:
7z --help
or 7z
(without parameter)
7-Zip Command Line User's Guide
MainFolder
path has spaces in it, wrap the whole path in quotes, otherwise 7z will just ignore your pattern and compress all the files.
Jan 21, 2019 at 14:31
7z.exe a -tzip metadata.zip -ir!.\*.xmp
I had "Too short switch/Cannot find file" error/warning. Added quotes to path and went perfect 7z.exe a -tzip metadata.zip -ir!".\*.xmp"
zip -r foo /MainFolder -i '*.py' '*.pdf' '*.tex' '*.doc' '*.docx'