PDA

View Full Version : Winzip command prompt and conditionally deleting files in windows 2k/2 (All)



aveerara
05-10-2004, 06:44 AM
Every month, we have to compress specific files from a particular folder and delete them. I am able to compress so far, but dont know how to delete. I am trying to delete files older than a particular date using windows scripting. Here's my code so far.

Dim WshShell, oExec
Set WshShell = CreateObject("WScript.Shell")

Set oExec = WshShell.Exec(" ""C:\Program Files\WinZip\wzzip"" -ex -Tf04-04-15 ""D:\Logfiles\W3SVC1\2004-05-15.zip"" ""D:\Logfiles\W3SVC1\*.log""")

It gives me an error saying "The system cannot find the file specified". Code: 80070002. Source: WshShell.exec

In the dos prompt, I tried to run the following command: "C:\Program Files\WinZip\wzzip" -ex -Tf04-04-15 "D:\Logfiles\W3SVC1\2004-05-15.zip" "D:\Logfiles\W3SVC1\*.log" and it ran perfectly. I checked the zip file created and it was good. Is there a reason the file doesn't work when it is run as a vbs script?

Next, i tried to incorporate -d in the command line to delete the files that have been compressed. However, I got an error saying -d and -T cannot be combined in the same command. So my next question is, how can I delete the files that are older than a particular date? Note that all files are .log files.

Any help would be appreciated. Thanks.
- Ananth

g707
05-25-2004, 07:04 AM
Anath,
I haven't been able to test this, but it has work for me when I've need to 'call' utilities from a shell prompt.

Try putting:
cmd /c
infront of the wzzip.exe

*******
* g707 *
*******

dearnr
10-20-2005, 08:19 AM
Did you get this sorted as I have exactly the same problem.