12

I have one folder which will contain below mentioned files:

destiny.txt
destiny1.txt
destiny2.txt
destiny3.txt
destiny4.txt
destiny5.txt
destiny6.txt
destiny7.txt

Out of which destiny1.txt, destiny4.txt, destiny6.txt are from batch1.

I am using 7zip to zip the files.

Can I pass these 3 files in a single step to create DestinyTest.zip?

Is it possible?

18

Can I pass these 3 files in a single step to create DestinyTest.zip

You can use the command line version of 7zip which is 7z.

From a command line:

7z a -tzip DestinyTest.zip destiny1.txt destiny4.txt destiny6.txt
  • a - Adds files to archive.
  • -tzip - Specifies the type of archive (we are creating a zip archive).

Further reading

  • Works for me - provided I don't comma-separate the file names. – RonaldPK Feb 15 '17 at 17:58
  • @RonaldPK You're correct. Answer updated. Thanks. – DavidPostill Feb 15 '17 at 18:00
  • The -T option is redundant, since 7-Zip infers the type from the extenion. It is also noteworthy that you must remember that there are two 7-Zip programs; 7z.exe is the command line interface, while 7zFN.exe is the graphical interface. – David A. Gray Oct 11 '17 at 7:05
2

If you have a file listing the files to make the zip, eg

create a list of files to archive, one on each line. This is an @-list, from DOS days, a number of proggies will do this for each line.

You can create such a file with dir /b destin*.* > zipme.lst, and then remove lines in a ascii editor (notepad or edit).

type zipme.lst destiny1.txt destiny4.txt destiny6.txt 7za a -tzip DestinyTest.zip @zipme.lst

This will find zipme.lst, and add all the files listed in it. It can be longer than the command-line, and you have some control over it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.