This is the internal zip packer from Total Commander:
However I want to use my 7zip packer. When I select 5 files, I get 5 separate .zip archives for each selected file. How do I do that in 7zip?
7-ziparchivingpackertotal-commanderzip
This is the internal zip packer from Total Commander:
However I want to use my 7zip packer. When I select 5 files, I get 5 separate .zip archives for each selected file. How do I do that in 7zip?
Best Answer
I am not sure you can do what you are suggesting using the graphical user interface, but you can certainly from the command line:
You would need to change directory (the
cd
command) to theF:\Downloads
directory first, or whatever directory you would want to perform the mass compression. Also, it is easy enough to substitute in *.exe or whatever extension you want to filter for to just compress those documents.And the secret decoder ring:
%i
is a variable that holds the file name for each step in the loop(*.*)
is the selection criteria, it could easily be *.exe or similar7z.exe
is the command line version of 7-Zip%~ni
- this expands the %i variable to just the file name - no extensionIf you wanted to just add the folders for a given directory, the command is a bit more complex as by default FOR just works with files. We need to feed it some additional information:
This works because of a few pieces of what seems like magic:
/F
tells FOR to iterate over the expanded value in ()usebackq
tells FOR that I am going to pass a command and use the output to iteratedelims=?
tells FOR that I want to break tokens apart on the?
- an illegal character in file names and directories. I only want one token./B
inDIR
is for bare format - just the name/A:D
inDIR
is for restricting the results by attribute, the D is for directoriesIf you want to encapsulate this inside of a batch file, the only change you will need to make is to double escape the %i variable: