Login | |
|
 |
using fileexists method with wildcard - 3/22/2005 1:06:42 AM
|
|
 |
|
| |
netherxx
Posts: 8
Score: 0
Joined: 3/22/2005
From:
Status: offline
|
Hi there, first of all, sorry for my crappy english. I relatively new with vbscript/wsh. I am creating a script that will automatically move a series of tars to a directory, that is named to the date that the script has been run. That part does work. However, i want the script to check if there are *.index files in the directory, and if they are there, the script should end. Now, i have got the script so far that it will check for a specific file, but not for a bunch of files i have specified with a wild card in the fileexists method. Can you help me? Thanks in advance Kind regards, Rolf Dim wshnetwork, fso, lfile Const ForReading = 1, ForWriting = 2, ForAppending = 8 Set wshnetwork = WScript.CreateObject("wscript.network") Set fso = CreateObject("scripting.filesystemobject") Set Lfile = fso.OpenTextFile("c:\call-it.log", ForWriting, True) On Error Resume Next Lfile.WriteLine Now & "-> verwijderen van netwerkmapping K:" wshnetwork.RemoveNetworkDrive "K:" Lfile.WriteLine Now & "-> maken van netwerkmapping K:" wshnetwork.MapNetworkDrive "K:", "\\deltamdb02\vpcprod\call_it" lfile.WriteLine Now & "-> checken of er nog indexen bestaan in de map verwerken" If (fso.FileExists("k:\verwerken\*.index"))=false Then lfile.WriteLine Now & "-> error! er bestaan nog indexen in de verwerken map. Bestanden worden niet verplaatst" WScript.Quit Else lfile.WriteLine Now & "-> er bestaan geen indexen. Indexen zijn verwerkt" End if Lfile.WriteLine Now & "-> maken van backupmap op \\deltamdb02\vpcprod\call_it\ready\" fso.CreateFolder ("K:\ready\"&date) Lfile.WriteLine Now & "-> verplaatsen van alle tars" fso.MoveFile "k:\verwerken\*.tar", "K:\ready\"&date lfile.WriteLine Now & "-> verwijderen van netwerkmapping K:" wshnetwork.RemoveNetworkDrive "K:" lfile.Close
|
|
| |
|
|
|
|
|