I'm by no means a programmer, but I'm trying to automate a process using a combination of VBS and Batch files. First I execute a FTP batch file named simply ftp.bat that goes out to a mainframe and downloads several .DAT files. That works great. Next, I have a vbs script(zipit.vbs) that "calls for" another batch file (zip.bat) if a user chooses "yes" on a message box, else it basically stops. Here's the script code for the message box and "calling for" the zip.bat (zip.bat uses the command line add-on for Winzip)
zipit.vbs:
dim choice
Dim WSHShell
choice = msgbox ("Are You Sure That You Want To ZIP All Files With A .DAT Extention From The C:\DOWNLOAD Directory???",vbyesnocancel,"Watch Out!!!I'm Going To ZIP UP ALL .DAT Files!"
if choice = 6 then
Set WSHShell = WScript.CreateObject("WScript.Shell"
' This will run the zip batch file on demand.
WSHShell.Run "zip.bat", 1, false
Set WSHShell = Nothing
WScript.Quit(0)
end if
if choice = 7 then
msgbox "Not Going To ZIP At This Time!!!!",vbcritical,"No ZIP!"
end if
if choice = 2 then
msgbox "Canceling ZIP Operation!!!!",vbcritical,"Cancel This Operation!!!!"
end if
O.k., with this in mind, here's the simple zip.bat
syntax:wzzip -yp -b z:\dayendstring *.dat
rename z:\dayendstring.zip "%DATE%".zip
All of the above works fine. You'll notice that z: drive is on our network, this is where I'm going to store these zip files for archives. This actually puts the zip out there with the name dayendstring.zip. I want to somehow rename the dayendstring.zip to a date.zip (in other words 08/01/01 is what I mean by date) I know that Windows/DOS etc. doesn't like "/" in the file names, that's why the rename command in the batch file doesn't work. However, I know that "-" do work, but am uncertain how to do that from this point on. Could someone pls help me figure this one out??? Thank you so much in advance!!!
Joe W. Guy
Network Admin
MIS Director
zipit.vbs:
dim choice
Dim WSHShell
choice = msgbox ("Are You Sure That You Want To ZIP All Files With A .DAT Extention From The C:\DOWNLOAD Directory???",vbyesnocancel,"Watch Out!!!I'm Going To ZIP UP ALL .DAT Files!"
if choice = 6 then
Set WSHShell = WScript.CreateObject("WScript.Shell"
' This will run the zip batch file on demand.
WSHShell.Run "zip.bat", 1, false
Set WSHShell = Nothing
WScript.Quit(0)
end if
if choice = 7 then
msgbox "Not Going To ZIP At This Time!!!!",vbcritical,"No ZIP!"
end if
if choice = 2 then
msgbox "Canceling ZIP Operation!!!!",vbcritical,"Cancel This Operation!!!!"
end if
O.k., with this in mind, here's the simple zip.bat
syntax:wzzip -yp -b z:\dayendstring *.dat
rename z:\dayendstring.zip "%DATE%".zip
All of the above works fine. You'll notice that z: drive is on our network, this is where I'm going to store these zip files for archives. This actually puts the zip out there with the name dayendstring.zip. I want to somehow rename the dayendstring.zip to a date.zip (in other words 08/01/01 is what I mean by date) I know that Windows/DOS etc. doesn't like "/" in the file names, that's why the rename command in the batch file doesn't work. However, I know that "-" do work, but am uncertain how to do that from this point on. Could someone pls help me figure this one out??? Thank you so much in advance!!!
Joe W. Guy
Network Admin
MIS Director