Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


RE: 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 >> RE: 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: <<   < prev  1 [2]
Login
Message << Older Topic   Newer Topic >>
 RE: Complicated: read a filename if its yesterdays date... - 12/21/2006 3:44:20 AM   
  ehvbs

 

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

I don't understand the need for any IFs in the first place. Arent't you concatenating
the suffix as you get it from

   fileNumber = Mid(objFile.Name,22,2)

to the outputfilename regardlessly of its current value:

    outputFileName = outputFolder & "\" & CheckYear & CheckMonth & CheckDate & "_" & FileNumber & ".txt"

What am I overlooking?

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


Posts: 5246
Score: 31
Joined: 7/12/2005
Status: offline
fileNumber = Mid(objFile.Name,22,2)
Select Case fileNumber
   Case "02"
         outputFileName = outputFolder & "\" & CheckYear & CheckMonth & CheckDate & "_" & FileNumber & ".txt"
   Case "01"
         outputFileName = outputFolder & "\" & CheckYear & CheckMonth & CheckDate & "_" & FileNumber & ".txt"
     Case "00"
          outputFileName = outputFolder & "\" & CheckYear & CheckMonth & CheckDate & "_" & fileNumber & ".txt"
End Case

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to swerver)
 
 
Post #: 22
 
 RE: Complicated: read a filename if its yesterdays date... - 12/21/2006 3:46:57 AM   
  ehvbs

 

Posts: 2222
Score: 50
Joined: 6/22/2005
From: Germany
Status: offline
Hi ebgreen,

in exchange for "End Select" - can you answer my question?

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


Posts: 5246
Score: 31
Joined: 7/12/2005
Status: offline
Ooops.... Oh well. I didn't include a default case either which I usually consider to be a good thing. I can't answer your question however.

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to ehvbs)
 
 
Post #: 24
 
 RE: Complicated: read a filename if its yesterdays date... - 12/21/2006 3:59:35 AM   
  swerver

 

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

ORIGINAL: ehvbs

Hi swerver,

I don't understand the need for any IFs in the first place. Arent't you concatenating
the suffix as you get it from

fileNumber = Mid(objFile.Name,22,2)

to the outputfilename regardlessly of its current value:

outputFileName = outputFolder & "\" & CheckYear & CheckMonth & CheckDate & "_" & FileNumber & ".txt"

What am I overlooking?


Because there can be various filename endings that need to be added to the outputFileName ?
eg _000.mdf or _001.mdf or _002.mdf etc... in fact, I'm not sure what the limit could be... so need to loop really?

Would the case do that?

Computationaly, which is the best to use?

< Message edited by swerver -- 12/21/2006 4:04:02 AM >

(in reply to ehvbs)
 
 
Post #: 25
 
 RE: Complicated: read a filename if its yesterdays date... - 12/21/2006 8:08:46 PM   
  ehvbs

 

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

This is a simple proof of concept/test script, to experiment with 'numbered file copy':


      

Typical use:


      

Good luck!

ehvbs

(in reply to swerver)
 
 
Post #: 26
 
 RE: Complicated: read a filename if its yesterdays date... - 12/21/2006 10:32:46 PM   
  swerver

 

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

I mean... WOW...


(now I am confused!)



(in reply to ehvbs)
 
 
Post #: 27
 
 RE: Complicated: read a filename if its yesterdays date... - 12/22/2006 1:35:32 AM   
  ehvbs

 

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

the script lets you do three things:

(1) generate a bunch of test files in .\test. The files are named according
     to the scheme you described in your first postings.
(2) process <nNumFiles> of these. "Process" here means only: copy using
      a new name derived from the old one to .\test\processed (I can't use
      msdetotext.vbs)
      As we know from the name whether a file is processed already, we can
      use the fact that a 'processed' file exists to control whether or not a
      copy is necessary
(3) to multiply the files from .\test. This demonstrates how to use ebgreen's
     Sub  NumberCopy() to generate a sequence of numbered copies of a
     file. (Another application of the algorithm is used inline in the generate
     code)

Is there anything specific you want me to explain?

ehvbs

(in reply to swerver)
 
 
Post #: 28
 
 
Page:  <<   < prev  1 [2]
 
  

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 >> RE: Complicated: read a filename if its yesterdays date write CMD Page: <<   < prev  1 [2]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts