Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 759
  • Last Modified:

7zip batch script

I'm looking for a 7zip batch script to archive .pdf and .txt files in one archive with a .zip extension.
0
lsbrown1
Asked:
lsbrown1
1 Solution
 
pabmaCommented:
Not the best specification I've seen, but hey! :-)

Are the files across multiple directories, or all in a single directory?
0
 
Meir RivkinFull stack Software EngineerCommented:
create file called listfile.txt and add the source directory of *.pdf and *.txt files you want to archive.

for example:
c:\temp\*.pdf
c:\temp\txt\*.txt

run the following code:

7z.exe a -tzip archive.zip @listfile.txt

Open in new window


after the @ should come the full path of the listfile.txt, unless running from he same directory
0
 
lsbrown1Author Commented:
This is the code I was  using but Im getting errors: (1) its saving files in  c:\Program Files\7-Zip, I want it to save .zip in c:\Inetpub\ftproot\xxxxxxx( c:\Inetpub\ftproot\xxxxxxx is also where the .pdf and .txt files I want to zip is located) (2) its not giving me the date stamp


cd  c:\Program Files\7-Zip
7z.exe a -tzip xx_xxxxx_`date +%Y%m%d`.zip c:\Inetpub\ftproot\xxxxxxx\*.pdf *.txt
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now