WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Zipper

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

zZipFiles with File List

Keywords: 	 delimited file list

Question:

I am trying to write a simple script to backup certain directories (incl subdirs) from a local drive to a .zip file on a server. However, I can't seem to find the right syntax.

I want to backup the entire contents of the following diretories:

	C:\My Documents
	C:\Progra~1\Netscape\Users\*\mail
	C:\Progra~1\Netscape\Users\*\archive
	C:\Progra~1\Netscape\Users\*\news
including subdirs, to a zipfile on a server. The syntax I'm using is:
	ret=zZipFiles("R",archive,"C:\My Documents\*.*")
	dirlist=diritemize("C:\Program Files\Netscape\Users\*")
	for i=1 to itemcount(dirlist,@TAB)
		dir=itemextract(i,dirlist,@TAB)
		dirchange("c:\program files\netscape\users\%dir%")
		ret=zZipFiles("g R",archive,"*.* mail\*.* archive\*.* news\*.*")
	next
What am I doing wrong?

Answer:

A couple of things:
  1. zZipFiles has a 4th parameter (exclude files). In your case, specify ""

  2. Add a dirchange to where you want the archive file created, and specify archive file. Archive file must be successfully created for the next zZipFiles with "g" option to succeed.

  3. Put "|" delimiters in file lists. See below:
    	AddExtender("WWZIP34I.DLL")
    	DirChange("C:\My Documents")
    	archive="C:\My Documents\archive.zip"
    	ret=zZipFiles("R",archive,"C:\My Documents\*.*","")
    	message("",ret)
    	dirlist=diritemize("C:\Program Files\Netscape\Users\*")
    	message("",dirlist)
    	for i=1 to itemcount(dirlist,@TAB)
    		dir=itemextract(i,dirlist,@TAB)
    		dirchange("c:\program files\netscape\users\%dir%")
    		ret=zZipFiles("g R",archive,"*.*|mail\*.*|archive\*.*|news\*.*","")
    		message("",ret)
    	next 
    

    Article ID:   W14111
    
    Filename:   zZipFiles with File List.txt
    File Created: 2017:07:28:13:58:56
    Last Updated: 2001:03:01:15:02:24