Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Complicated: read a filename if its yesterdays date write CMD

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,41166
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Complicated: read a filename if its yesterdays date write CMD
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1] 2   next >   >>
Login
Message << Older Topic   Newer Topic >>
 Complicated: read a filename if its yesterdays date wri... - 12/18/2006 10:22:38 PM   
  swerver

 

Posts: 27
Score: 0
Joined: 12/18/2006
Status: offline
Hi there,
 
I need a script that will:
 
get yesterdays date, read a filename, if the filename was created on yesterdays date, then write a CMD line.
(the CMD runs MSDEtoText which converts MSDE files to text)
 
There may be multiple files on created on that date.
 
The filenames to read contain the date eg
 
ISA_20061219_000.mdf
ISA_20061219_001.mdf
 
The output to the CMD prompt must contain the filename and the extracted date ie 20061219
The CMD line must be writted for each file found for the previous date.
 
eg
<msdetotext.vbs ISA_20061101_000 webproxylog f:\Exported\20061101.txt>
 
1) msdetotext.vbs converts MSDE logs to text file. This is a Microsoft produced script.
2) The 2nd parameter is the file name to be converted less the extension.
3) WebProxyLog is the type of log, but this is a fixed variable.
4) The path can be anywhere, but the converted file name must contain the date – i.e. match the date in the original file.
 
I'll use a scheduled task to launch the script.
Anyone?

< Message edited by swerver -- 12/18/2006 10:23:52 PM >
 
 
Post #: 1
 
 RE: Complicated: read a filename if its yesterdays date... - 12/18/2006 11:08:56 PM   
  ehvbs

 

Posts: 2222
Score: 50
Joined: 6/22/2005
From: Germany
Status: online
Hi swerver,

it depends on what you left out between "Anyone" and "?". If that was

  "to write this script for me"
        => No, at least not me

  "to discuss a plan for this script with me"
        => Yes, but further info needed; e.g. how will files to be processed
              specified - a list? user input? same magic to find 'new' files?

  "to provide some keywords for the VBScript Docs/Google"
        => Now, DateAdd/DateDiff, WShell.Run/.Exec

Good luck!

ehvbs

(in reply to swerver)
 
 
Post #: 2
 
 RE: Complicated: read a filename if its yesterdays date... - 12/18/2006 11:22:31 PM   
  swerver

 

Posts: 27
Score: 0
Joined: 12/18/2006
Status: offline
Hi!

A discussion is cool with me...

I need to read all the files in the directory of the script.
There will be no user input as the script will run from a scheduled task.
the CMD line lauches the conversion VBScript provided by Microsoft.
My script just needs to get the required parameters for the CMD line.

Pseudo-code
 
GetDate
Set previousDate.
 
Get DateCreated for files *.mdf
Get FileName for file *.mdf
 
Set FileNameExt to equal FileName minus file extension
Set FileDate to equal FileNameExt minus “ISALog_” & ”_Web_000”
 
If PreviousDate = DateCreated
 
            If FileName contains “Web_001”
 
  write CMD (“msdetotext.vbs” & FileNameExt & “webproxylog” & “f:exported\” & FileDate & “-1.txt”
 
            else
           
            If FileName contains “Web_002”
 
  write CMD (“msdetotext.vbs” & FileNameExt & “webproxylog” & “f:exported\” & FileDate & “-2.txt”
 
            else
           
  write CMD (“msdetotext.vbs” & FileNameExt & “webproxylog” & “f:exported\” & FileDate & “.txt”
 
            end if
 

(in reply to ehvbs)
 
 
Post #: 3
 
 RE: Complicated: read a filename if its yesterdays date... - 12/18/2006 11:37:12 PM   
  ehvbs

 

Posts: 2222
Score: 50
Joined: 6/22/2005
From: Germany
Status: online
Hi swerver,

be aware that it can be a risk (side ways, garden pathes) to cooperate with me.
My proposal

Store ThisDate
Store PrevDate (DateAdd)
Store Folder

For All Files In Folder  (FSO.GetFolder; Folder.Files)
    Get all relevant info about current file
    Use this info to determine action
    Select Case action
        Case DoIt with Web_001 file
            build/write/execute CMD ("msdetotext.vbs” & FileNameExt & "webproxylog” & "f:exported\” & FileDate & "-1.txt”
            handle possible errors
        Case ...
        Case file may be ignored
            Log "nothing to be done with " + File.Name
    End Select
Next

A question concerning higher level decisions: why are the date so important?

  

(in reply to swerver)
 
 
Post #: 4
 
 RE: Complicated: read a filename if its yesterdays date... - 12/18/2006 11:42:05 PM   
  swerver

 

Posts: 27
Score: 0
Joined: 12/18/2006
Status: offline
 
yeah that's about it!


the dates important as we will run the script on a daily basis and only want to convert the previous days files.

we have 15 ISA servers to run this on!

(in reply to ehvbs)
 
 
Post #: 5
 
 RE: Complicated: read a filename if its yesterdays date... - 12/18/2006 11:50:13 PM   
  ehvbs

 

Posts: 2222
Score: 50
Joined: 6/22/2005
From: Germany
Status: online
I don't want to insist; let's use dates. But what about missing a whole day's files
because the script didn't run (successfully) on server 11 last sunday?

Get all relevant info about current file
  Get name, split into interesssing parts (file.Name, .Path, RegExp?)
  Get date (create, written, accessed?), split into interesting parts (Month,..., or RegExp)
  combine info intellegently (?) to determine action

your move, swerver!

(in reply to swerver)
 
 
Post #: 6
 
 RE: Complicated: read a filename if its yesterdays date... - 12/18/2006 11:52:36 PM   
  kirrilian


Posts: 628
Score: 3
Joined: 3/15/2005
From:
Status: offline
if this were me, with 15 servers to run this on, i would switch to a more centralized script and run it from one machine

eg. search via wmi for the file
get the files over a file share (\\server\file)
process them
keep all the logs locally on the server the script runs on

_____________________________

Have you searched here ?
VBScript Fundamentals
My Site

(in reply to swerver)
 
 
Post #: 7
 
 RE: Complicated: read a filename if its yesterdays date... - 12/18/2006 11:56:38 PM   
  ehvbs

 

Posts: 2222
Score: 50
Joined: 6/22/2005
From: Germany
Status: online
Hi kirrilian, welcome to this discussion.
Disclaimer: I have few/no knowledge/skills/experience with doing it to servers.

(in reply to kirrilian)
 
 
Post #: 8
 
 RE: Complicated: read a filename if its yesterdays date... - 12/19/2006 12:01:12 AM   
  kirrilian


Posts: 628
Score: 3
Joined: 3/15/2005
From:
Status: offline
well my general rule of thumb is this (for servers or workstations)

if i have to run the same script on two or more machines i generally try to centralize it for easier control and maintenance

(wait til you find a bug and have to redeploy the script back out to 15 servers, or check the logs on each of them and youll see what im talking about ;))

the only caveat that i can think of is that you may not have the full functionality you need and wmi is notoriously slow...

on that note, i am going back to bed

ill check back when i get back up

_____________________________

Have you searched here ?
VBScript Fundamentals
My Site

(in reply to ehvbs)
 
 
Post #: 9
 
 RE: Complicated: read a filename if its yesterdays date... - 12/19/2006 12:26:01 AM   
  ehvbs

 

Posts: 2222
Score: 50
Joined: 6/22/2005
From: Germany
Status: online
In between: a simple way to deal with string concatenation:

Dim sCmdTmplate : sCmdTmplate = _
"cscript msdetotext.vbs ""@SrcFSpec@"" webproxylog ""@DstFSpec@"""
...
     SCmd = Replace( "@SrcFSpec@", sSrcFSpec )
     SCmd = Replace( "@DstFSpec@", sDstFSpec )
     WScript.Echo "Cmd: |" + sCmd + "|"

that could be improved by using a dictionary to the placeholders (keys)
and the replacements (values) and a reusable functions that given a
string and such a dictionary returns the string with all replacements
done.

[Bye, kirrilian, hope you get better soon]

(in reply to kirrilian)
 
 
Post #: 10
 
 RE: Complicated: read a filename if its yesterdays date... - 12/19/2006 12:38:11 AM   
  swerver

 

Posts: 27
Score: 0
Joined: 12/18/2006
Status: offline
quote:

ORIGINAL: ehvbs

I don't want to insist; let's use dates. But what about missing a whole day's files
because the script didn't run (successfully) on server 11 last sunday?

Get all relevant info about current file
Get name, split into interesssing parts (file.Name, .Path, RegExp?)
Get date (create, written, accessed?), split into interesting parts (Month,..., or RegExp)
combine info intellegently (?) to determine action

your move, swerver!


Hi,

how else would I handle the process if not using the Date function? How would it work on for the previous day without calling the date?
The key attribute are the filename and the date modified.

The files we are concerned with are MSDE logs on an ISA Server. The way Microsoft have set these up is that they have to be converetd to text inorder to read them and this conversion has to be done on an ISA as far as I am aware i.e. they are locked down so that only the ISA can modify them.





(in reply to ehvbs)
 
 
Post #: 11
 
 RE: Complicated: read a filename if its yesterdays date... - 12/19/2006 12:42:52 AM   
  swerver

 

Posts: 27
Score: 0
Joined: 12/18/2006
Status: offline
quote:

ORIGINAL: kirrilian

if this were me, with 15 servers to run this on, i would switch to a more centralized script and run it from one machine

eg. search via wmi for the file
get the files over a file share (\\server\file)
process them
keep all the logs locally on the server the script runs on


Kirrilian,

That would indeed be best. We have a Logging server which could map drives to the UNC Path.
As it happens we will want to copy all the logs we convert in the script to this logging server for back up to DVD.


NOTE:
The code to write the CMD line is

Set oShell = WScript.CreateObject ("WScript.shell")

oShell.run "cmd /msdetotext.vbs ISALog_20061812_WEB_000 webproxy f:\ISA_logs\20061812.txt"

(in reply to kirrilian)
 
 
Post #: 12
 
 RE: Complicated: read a filename if its yesterdays date... - 12/19/2006 3:03:57 AM   
  swerver

 

Posts: 27
Score: 0
Joined: 12/18/2006
Status: offline
Option Explicit
Dim DateToCheck    'Date - This will be calculated as the day before the script is run
Dim FilenameRegExp   'String - A regular expression to find all files containing the previous day's date
Dim CheckYear    'Integer - The year component of the previous day's date
Dim CheckMonth    'Integer - The month component of the previous day's date
Dim CheckDate    'Integer - The day component of the previous day's date
Dim objFSO    'File System Object
Dim objFolder    'Folder Object
Dim inputFolder    'String - Folder/Directory containing the log files you need processing
Dim outputFolder   'String - Folder/Directory where you want the output to go
Dim colFiles    'Object representing list of files
Dim objFile    'Object representing a single file
Dim objShell    'Object representing a shell access
Dim objExecObject   'Onject represneting an external process
Dim tempFileName   'String - temporary file name used to identify files that were created yesterday
Dim fileNameLength   'Int - the length of the file name being checked
Dim fileNumber    'Int - the number attached at the end of the filename eg. 001 from ISALOG_20061101_WEB_001.MDF
Dim inputFileName   'String - the filename to pass to the other vbscript
Dim outputFileName   'String - the filename to output the file to.
inputFolder = "D:\test"   'change as required
outputFolder = "D:\test\processed"
DateToCheck = DateAdd("d",-1,Date)
CheckYear = DatePart("yyyy" , DateToCheck)
CheckMonth = DatePart("m" , DateToCheck)
CheckDate = DatePart("d" , DateToCheck)
'Set the filename(s) to Search for
tempFileName = "ISALOG_" & CheckYear & CheckMonth & CheckDate
Set objFSO = CreateObject("Scripting.FileSystemObject")
Wscript.Echo "Checking status of directory " & inputFolder
If objFSO.FolderExists(inputFolder) Then
Set objFolder = objFSO.GetFolder(inputFolder)
Else
Wscript.Echo "Folder does not exist"
End If
Set colFiles = objFolder.Files
Wscript.Echo "Checking for log files from " & DateToCheck
For Each objFile in colFiles
if InStr (objFile.Name, tempFileName) > 0 Then
Wscript.Echo "Processing " & objFile.Name
fileNameLength = Len(objFile.Name)

'Generate the ISALOG_20061101_WEB_000 part of the filename
inputFileName = Left(objFile.Name, fileNameLength - 4)
'Change the 22 in the following line to 21, and the 2 to 3 if you need to expand from _01, 02 to _001, 002 filenames
fileNumber = Mid(objFile.Name,22,2)
if fileNumber = "00" Then
 outputFileName = outputFolder & "\" & CheckYear & CheckMonth & CheckDate & ".txt"
else
 outputFileName = outputFolder & "\" & CheckYear & CheckMonth & CheckDate & "_" & fileNumber & ".txt"
End if
              Wscript.Echo "msdetotext.vbs " & inputFileName & " webproxylog " & outputFileName
'Uncomment the lines below, and this SHOULD run as intended.
'Set objShell = WScript.CreateObject("WScript.Shell")
'Set objExecObject = objShell.Exec(""msdetotext.vbs " & inputFileName & " webproxylog " & outputFileName")

End If
Next

< Message edited by swerver -- 12/20/2006 1:11:08 AM >

(in reply to swerver)
 
 
Post #: 13
 
 RE: Complicated: read a filename if its yesterdays date... - 12/19/2006 6:57:27 AM   
  kirrilian


Posts: 628
Score: 3
Joined: 3/15/2005
From:
Status: offline
ok back, i feel a lil better now so can focus better ;)

regarding the date, that's fairly simple to get yesterday's date date() - 1

however I noticed that you have a specific format that you need so we will have to use/modify an existing function that I use
you can use your date setup until you get to a date that only has one digit (like next month) and you will lose your zero...

ISALOG_20061101_WEB_000

this should work
prevDate = Year(Now()) & Right("0" & Month(now()), 2) & Right("00" & Day(Now() - 1), 2)

to mount a share from another server...
Sub mapShare(yn,server,share)
'local drive to mount to
drive = "B:"
Set WshNetwork = WScript.CreateObject("WScript.Network")
If yn = "y" Then
WshNetwork.MapNetworkDrive drive, "\\" & server & "\" & share
WScript.Echo "Share mounted On " & drive & " from " & server & " With remote path " & share
Else
WSHNetwork.RemoveNetworkDrive drive
WScript.Echo "Share unmounted from " & server
End If
Set WshNetwork = Nothing
End Sub 'mapShare

now, having said all that, here is how i would create the flow
(pseudo code follows)
servers = array("server1","server2", ...) 'until you get all 15

create FSO stuff here
for each server in servers
'mount share
mountshare "y",server,"c$\path\to\files"
if fso.fileexists(filename)
'process files
end if
mountshare "n",server,""
next

how bout that...

_____________________________

Have you searched here ?
VBScript Fundamentals
My Site

(in reply to swerver)
 
 
Post #: 14
 
 RE: Complicated: read a filename if its yesterdays date... - 12/20/2006 12:50:34 AM   
  swerver

 

Posts: 27
Score: 0
Joined: 12/18/2006
Status: offline
OK...

my script does not work...

When running a test on my PC... the echo's bring the function onto the screen.

when running on the Server, a CMD prompt appears briefly, then nothing.
I've commented out the CMD write part but there are no screen echo's


Any one got any idea why?

Is there a security setting? We have other scripts running fine on the server.

< Message edited by swerver -- 12/20/2006 1:14:05 AM >

(in reply to kirrilian)
 
 
Post #: 15
 
 RE: Complicated: read a filename if its yesterdays date... - 12/20/2006 2:43:34 AM   
  swerver

 

Posts: 27
Score: 0
Joined: 12/18/2006
Status: offline
Option Explicit
Dim DateToCheck    'Date - This will be calculated as the day before the script is run
Dim FilenameRegExp   'String - A regular expression to find all files containing the previous day's date
Dim CheckYear    'Integer - The year component of the previous day's date
Dim CheckMonth    'Integer - The month component of the previous day's date
Dim CheckDate    'Integer - The day component of the previous day's date
Dim objFSO    'File System Object
Dim objFolder    'Folder Object
Dim inputFolder    'String - Folder/Directory containing the log files you need processing
Dim outputFolder   'String - Folder/Directory where you want the output to go
Dim colFiles    'Object representing list of files
Dim objFile    'Object representing a single file
Dim objShell    'Object representing a shell access
Dim objExecObject   'Onject represneting an external process
Dim tempFileName   'String - temporary file name used to identify files that were created yesterday
Dim fileNameLength   'Int - the length of the file name being checked
Dim fileNumber    'Int - the number attached at the end of the filename eg. 001 from ISALOG_20061101_WEB_001.MDF
Dim inputFileName   'String - the filename to pass to the other vbscript
Dim outputFileName   'String - the filename to output the file to.
inputFolder = "D:\test"   'change as required
outputFolder = "D:\test\processed"
' The DatePart function is a generic function that can retrieve any portion of a date or time value
DateToCheck = DateAdd("d",-1,Date)
CheckYear = DatePart("yyyy" , DateToCheck) 'Returns the year from the date-time value
CheckMonth = DatePart("m" , DateToCheck) 'Returns the month of the year with January 1 being 1 and December 31 being 365 (366 during leap years). For example, February 1 returns 32 because it is the 32nd day of the year.
CheckDate = DatePart("d" , DateToCheck) 'Returns the day of the month. For example, both April 17 and August 17 return 17.
'Set the filename(s) to Search for
tempFileName = "ISALOG_" & CheckYear & CheckMonth & CheckDate
Set objFSO = CreateObject("Scripting.FileSystemObject")
Wscript.Echo "Checking status of directory " & inputFolder
If objFSO.FolderExists(inputFolder) Then
Set objFolder = objFSO.GetFolder(inputFolder)
Else
Wscript.Echo "Folder does not exist"
End If
Set colFiles = objFolder.Files
Wscript.Echo "Checking for log files from " & DateToCheck

For Each objFile in colFiles
If LCase(Right(objFile.Name, 4)) = ".mdf" Then
if InStr (objFile.Name, tempFileName) > 0 Then
 Wscript.Echo "Processing " & objFile.Name
 fileNameLength = Len(objFile.Name)
 
 'Generate the ISALOG_20061101_WEB_000 part of the filename
 inputFileName = Left(objFile.Name, fileNameLength - 4)
 'Change the 22 in the following line to 21, and the 2 to 3 if you need to expand from _01, 02 to _001, 002 filenames
 fileNumber = Mid(objFile.Name,22,2)
 if fileNumber = "02" Then
  outputFileName = outputFolder & "\" & CheckYear & CheckMonth & CheckDate & "_" & FileNumber & ".txt"
  Else
   if fileNumber = "01" Then
  outputFileName = outputFolder & "\" & CheckYear & CheckMonth & CheckDate & "_" & FileNumber & ".txt"
  Else
   If fileNumber = "00" then
   outputFileName = outputFolder & "\" & CheckYear & CheckMonth & CheckDate & "_" & fileNumber & ".txt"
 End if
               Wscript.Echo "msdetotext.vbs " & inputFileName & " webproxylog " & outputFileName
 'set and run the parameters into CMD prompt
 Set objShell = WScript.CreateObject("WScript.Shell")
 Set objExecObject = objShell.Exec("msdetotext.vbs " & inputFileName & " webproxylog " & outputFileName)

 End if
End If
Next

Still getting no result when running on the server apart from when running from a CMD prompt.
This results in a "not a recognised Win32 application"

(in reply to swerver)
 
 
Post #: 16
 
 RE: Complicated: read a filename if its yesterdays date... - 12/20/2006 3:01:16 AM   
  ehvbs

 

Posts: 2222
Score: 50
Joined: 6/22/2005
From: Germany
Status: online
Hi swerver,

if you can do "cscript /h" and "cscript <yourscript>" in a CLI on the server, try
"cscript msdetotext.vbs <params>"; if that succeeds, change the command
for the .Exec accordingly.


(in reply to swerver)
 
 
Post #: 17
 
 RE: Complicated: read a filename if its yesterdays date... - 12/21/2006 2:45:10 AM   
  swerver

 

Posts: 27
Score: 0
Joined: 12/18/2006
Status: offline
this finished script now works:

Option Explicit
Dim DateToCheck    'Date - This will be calculated as the day before the script is run
Dim FilenameRegExp   'String - A regular expression to find all files containing the previous day's date
Dim CheckYear    'Integer - The year component of the previous day's date
Dim CheckMonth    'Integer - The month component of the previous day's date
Dim CheckDate    'Integer - The day component of the previous day's date
Dim objFSO    'File System Object
Dim objFolder    'Folder Object
Dim inputFolder    'String - Folder/Directory containing the log files you need processing
Dim outputFolder   'String - Folder/Directory where you want the output to go
Dim colFiles    'Object representing list of files
Dim objFile    'Object representing a single file
Dim objShell    'Object representing a shell access
Dim objExecObject   'Onject represneting an external process
Dim tempFileName   'String - temporary file name used to identify files that were created yesterday
Dim fileNameLength   'Int - the length of the file name being checked
Dim fileNumber    'Int - the number attached at the end of the filename eg. 001 from ISALOG_20061101_WEB_001.MDF
Dim inputFileName   'String - the filename to pass to the other vbscript
Dim outputFileName   'String - the filename to output the file to.
Dim runme     'string - the output CMD details.
inputFolder = "D:\test"   'change as required
outputFolder = "D:\test\processed"
' The DatePart function is a generic function that can retrieve any portion of a date or time value
DateToCheck = DateAdd("d",-1,Date)
CheckYear = DatePart("yyyy" , DateToCheck) 'Returns the year from the date-time value
CheckMonth = DatePart("m" , DateToCheck) 'Returns the month of the year with January 1 being 1 and December 31 being 365 (366 during leap years). For example, February 1 returns 32 because it is the 32nd day of the year.
CheckDate = DatePart("d" , DateToCheck) 'Returns the day of the month. For example, both April 17 and August 17 return 17.
'Set the filename(s) to Search for
tempFileName = "ISALOG_" & CheckYear & CheckMonth & CheckDate
Set objFSO = CreateObject("Scripting.FileSystemObject")
Wscript.Echo "Checking status of directory " & inputFolder
If objFSO.FolderExists(inputFolder) Then
Set objFolder = objFSO.GetFolder(inputFolder)
Else
Wscript.Echo "Folder does not exist"
End If
Set colFiles = objFolder.Files
Wscript.Echo "Checking for log files from " & DateToCheck

For Each objFile in colFiles
If LCase(Right(objFile.Name, 4)) = ".mdf" Then
if InStr (objFile.Name, tempFileName) > 0 Then
Wscript.Echo "Processing " & objFile.Name
fileNameLength = Len(objFile.Name)

'Generate the ISALOG_20061101_WEB_000 part of the filename
inputFileName = Left(objFile.Name, fileNameLength - 4)
'Change the 22 in the following line to 21, and the 2 to 3 if you need to expand from _01, 02 to _001, 002 filenames
fileNumber = Mid(objFile.Name,22,2)
if fileNumber = "02" Then
 outputFileName = outputFolder & "\" & CheckYear & CheckMonth & CheckDate & "_" & FileNumber & ".txt"
 Else
  if fileNumber = "01" Then
 outputFileName = outputFolder & "\" & CheckYear & CheckMonth & CheckDate & "_" & FileNumber & ".txt"
 Else
  If fileNumber = "00" then
  outputFileName = outputFolder & "\" & CheckYear & CheckMonth & CheckDate & "_" & fileNumber & ".txt"
End if
  Wscript.Echo "msdetotext.vbs " & inputFileName & " webproxylog " & outputFileName
RunMe = "msdetotext.vbs " & inputFileName & " webproxylog " & outputFileName
'set and run the parameters into CMD prompt
Set objShell = WScript.CreateObject("WScript.Shell")

objShell.Run(RunMe)


End if
End If
Next

It works...
thanks for all your help people!

< Message edited by swerver -- 12/21/2006 2:59:52 AM >

(in reply to ehvbs)
 
 
Post #: 18
 
 RE: Complicated: read a filename if its yesterdays date... - 12/21/2006 2:54:11 AM   
  ehvbs

 

Posts: 2222
Score: 50
Joined: 6/22/2005
From: Germany
Status: online
Hi swerver,

Your

  HOWEVER, THIS ONLY RUNS IF
  I go to to a command prompt and run it as wscript <scriptname.vbs>
  For some reason when I just double click the script, nothing happens....

indicates to me that on your server the association(s) of .vbs files to
c/wscript.exe aren't established. I think your system admin will be able
to tell you why.

So be carefull to help your script and the runtime system by being
explicit:

    "cscript msdetotext.vbs ...

or even

    "c:\whereever\cscript.exe msdetotext.vbs ...

Further spots of possible problems:

    permissions of the user running your script

    spaces in folder/files specifications

       "c:\whereever\cscript.exe msdetotext.vbs .... ""filespec""  ... ""filespec"" "

(had to correct those nasty " myself)

< Message edited by ehvbs -- 12/21/2006 2:56:14 AM >

(in reply to swerver)
 
 
Post #: 19
 
 RE: Complicated: read a filename if its yesterdays date... - 12/21/2006 3:31:23 AM   
  swerver

 

Posts: 27
Score: 0
Joined: 12/18/2006
Status: offline
I want to get rid of the If Else statements that looks for "01", "02" and "00" in the file name.

How do I put that into a case?

(in reply to ehvbs)
 
 
Post #: 20
 
 
Page:   [1] 2   next >   >>
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Complicated: read a filename if its yesterdays date write CMD Page: [1] 2   next >   >>
Jump to: