• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 739
  • 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

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

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