ZipIt.exe params not working

Sep 27, 2012 at 8:45 PM

I have been trying to add arguments to my command line in a batch file. I have tried adding the selector "*.txt"as shown in documentation examples:

  From the included help file in the executable:

    zip [-shortopts ...] [--longopt ...] [zipfile [path path ...]] [-xi list]

    No Example included

  From DotNetZip Command-Line Tools HTML file:

    ZipIt.exe <ZipFileToCreate> [arguments]

    Example: 

zipit.exe Backup.zip -d c:\MyDocuments -r+ -j- *.*
  create a new zip file called Backup.zip, adding all files within the c:\MyDocuments directory. Do not traverse NTFS Junction points (like My Videos).

*****************************************************************************

C:\Tools\ZipIt.exe E:\EP3-PC\2012-27-09\Backup.zip C:\Source -r+ "name = *.txt"

 Command                             ZipFile                  Source Folder     Selector

*****************************************************************************

Exception: System.IO.FileNotFoundException: That file or directory (-r+\-name) does n
ot exist!
   at Ionic.Zip.ZipFile.UpdateItem(String itemName, String directoryPathInArchiv
e)
   at Ionic.Zip.Examples.ZipIt.Main(String[] args)

*****************************************************************************

I've placed this selector without the "noun" and "operator" (which is shown as acceptable) both before and after the Source Folder (and in every other combination for that matter). I've tried using single and double quotes around each argument - still no dice :-(

In every instance I get the FileNotFoundException. If I remove the selector options

     C:\Tools\ZipIt.exe E:\EP3-PC\2012-27-09\Backup.zip C:\Source

it runs exactly as expected.

Can someone please fashion a working command line that will illuminate me on the proper syntax?

Thanks in advance for your help!

Sep 28, 2012 at 3:12 AM

I ended up trying to use ANY arguments, but none worked... This evening I d/l'd the source code for ionic.zip.dll and zipit.exe. I recompiled everything, but I ended up with the same results...

Any help would be appreciated - my ability to use this executable in a batch file is critical.

Oct 13, 2012 at 2:49 AM
Edited Oct 13, 2012 at 2:58 AM

OK - Still working on this...

I can get the parameters to work if I add them to the Command Line arguments in Visual Studio while using the ZipIt source code. I can use the following arguments and all works as designed:

E:\XXX-PC\SecurityAudits\2012-03-10\2012-10-10_9-42-48.zip -s Log.txt  "Backed up on Wed 10/010/2012 at  9:42:51.04" -D C:\VS\ArchivedLogs -r+ -E ctime>2012-10-02-07:53:00

I need to be able to pass in timestamp values to the variables that I'll use to backup and compress only files newer than the last backup. For now, I'm just trying to pass in the current timestamp.

Here is what I'm trying to do:

*********************************************************************************
@echo off
@setlocal
echo The date is %DATE%
set tagdate=%DATE:~-4%-%DATE:~7,2%-%DATE:~4,2%
echo %tagdate%
set backupfolder=C:\DATA
set destinationfolder=E:\%computername%\ProgData\%tagdate%
mkdir %destinationfolder%
echo backing up this folder:  %backupfolder%
set zipit=C:\Test\Tools\ZipIt.exe
set unzip=C:\Test\Tools\UnZip.exe
set tagtime=%time:~0,2%:%time:~3,2%:%time:~6,2%
echo tagtime=%time:~0,2%:%time:~3,2%:%time:~6,2%
echo %tagtime%
REM Everything works up to here
REM This strips any inline spaces 
set tagtime=%tagtime: =%
echo %tagtime%
set filetime=%time:~0,2%-%time:~3,2%-%time:~6,2%
echo %filetime%
set filetime=%filetime: =%
echo %filetime%
set zipfile=%destinationfolder%\%tagdate%_%filetime%.zip
echo %zipfile%
REM Again - all of the variables are being created correctly and are recalled correctly by ECHO
set selectors=-r+ -E mtime>%tagdate%-%tagtime% 
echo %selectors% 
"%zipit%" %zipfile% %backupfolder% %selectors% 
REM The selector variable gets passed without the %tagdate% variable, and subsequently errors out
*********************************************************************************
I have tried every concieveable combination of setting the variables %tagdate% and %tagtime% to match what the documentation calls for
and what actually works in Visual Studio, but can't seem to get the variables to pass through to the command line for proper execution.
Can anyone provide some assistance to get this working - I'm rapidly approaching my deadline, and I'm committed to ZipIt to get this done...
Thanks in advance,
Eric