Dear Phoenix, Les, and MCAI have tested the modified code from MCA which was an adaption of the code by Les and it does work as written by MCA.
NOTES
1.
I'm not sure if PKZIP command line addon supports long file names or not as I have not downloaded it and tested it. The older PKZIP DID NOT support Long File Names.
The WinZip 8 Commnad Line addon does support long file names.
2.
My own personal preference would be to use -rP which would include the "complete" path of where the zip file came from.
3.
You MUST add the program wzzip to your PATH before running. It might be possible to add a direct call to wzzip via further modifications of the script, but easier to just add it to the PATH.
Minor modifications and confirmation that the code does run with KiXtart 2001 and WinZip Command Line Support Add-On 1.0 which requires WinZip v8.0
code:
break on
$pkzip_mode="add" ; "move"
;
$basedir="d:\users"
$filename=Dir("$basedir")
WHILE ($filename <> "") AND (@error = 0)
IF ($filename <> ".") AND ($filename <> "..") AND (GetFileAttr($basedir+"\"+$filename) & 16)
; ? $basedir+"\"+$filename
GOSUB create_zip
ENDIF
$filename=Dir()
LOOP
EXIT
:create_zip
IF ($pkzip_mode = "add")
$cmd=" wzzip -a -ex -rP "
ELSE
$cmd=" wzzip -m -ex -rP "
ENDIF
$cmd=$cmd+' "$basedir'+'\'+LTRIM(RTRIM($filename))+'.zip" "$basedir'+'\'+'$filename'+'\*.*" '
SHELL '%comspec% /c $cmd' ; <++++++++++
;? $cmd
RETURN
That said, both the Script and Batch file perform as intended. 