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
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