VBScript - Read text from filename?

Discussion in 'Software' started by CobolExpert, Apr 15, 2005.

  1. CobolExpert

    CobolExpert Private E-2

    Hey all,
    I have a file called 'Build 3.19.9.2600'. Nothing inside of it, it's just an automated file that is generated by a build process. I need to grab the last four digits of that filename and then put it into a string so that I can create a folder with it... Any ideas on how to do that? I tried a few things and haven't been able to get it to work so I'm not sure if it is possible.

    I didn't find anything in my searches so hopefully this isn't a double post of something that was already answered.

    Thanks!
    JB
     
  2. Kodo

    Kodo SNATCHSQUATCH

    assuming you are familiar with the FileSystemObject.
    Dim fso,Fname,BuildNo
    Set fso = CreateObject("Scripting.FileSystemObject")
    fname= FSO.GetFileName("pathhere")
    BuildNo=right(fname,4)
     
  3. CobolExpert

    CobolExpert Private E-2

    Thanks Kodo. For some reason I was having problems with the last line. Brain Freeze I guess.

    -JB
     
  4. Kodo

    Kodo SNATCHSQUATCH

    no prob...heck, I started to write it out and I'm so used to .NET now that I had a brain fart too :)
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds