I've been reading some of the posts and am blown away by the level of coding and help on the forums. So I am a little embarrassed by the basic question I have :)
I'm admittedly an absolute novice when it comes to VBscript and can get my head around basics when needed, but as i have run into a problem. I thought I better try reaching out to the experts.
I had a batch script written to convert a filename to yesterdays date ddmmyyyy where, if mm = 01 would be changed to A and 02 would be B and so on. Although it worked it wasnt to robust when the month changed so I wanted to convert it to VBscript.
I managed to get a script together to convert the file to date name and change it from .csv to .txt but have now run into a small problem of converting mm from 01 to A.
I know it should be simple but the more i look at the script the more blank my mind goes.
What I need to achieve is converting the month as follows: 01 to A, 02 to B, 03 to C etc.
This is the script so far:
Const sWD = "c:Test"
Const sFName = "c:testtest1.csv"
Const sFName2 = "c:testtest2.csv"
Set oFSO = CreateObject("Scripting.FileSystemObject…
If Not oFSO.FolderExists(sWD) then Error "Cannot locate folder """ & sWD & """"
dYesterday = DateAdd("d", -1, Now())
sYesterday = 1000000 * Day(dYesterday) + 10000 * Month(dYesterday) + Year(dYesterday)
if not oFSO.FileExists(sFName) then Error "Cannot locate file """ & sFName & """"
if not oFSO.FileExists(sFName2) then Error "Cannot locate file """ & sFName2 & """"
oFSO.MoveFile sFName, sYesterday & ".txt"
oFSO.MoveFile sFName2, sYesterday & ".txt"
Free Guide: Managing storage for virtual environments
Complete a brief survey to get a complimentary 70-page whitepaper featuring the best methods and solutions for your virtual environment, as well as hypervisor-specific management advice from TechTarget experts. Don’t miss out on this exclusive content!