Hello everyone, I am new to the forums. I hope that someone can help me. I am new to VBS also and need to automate a script that I found online. I need the file name to be parsed a bit and I am not sure how to do it.
In the code below I am putting the filename plus "BB" into a txt file but I want to format the output of file.Name. For example, a file name is HHC_TTT_Doe_JOE_2013023.pdf and I just want want "HHC" or "TTT" or "JOE" or "2013023", how exactly do I do it? The lengths of the characters in the file name varies but it is separated by an underscore (_)
file.Name & " bb"
Dim folderSpec, file
GetUserInput folderSpec, "Please enter the unc path to the source folder", scriptBaseName, "C:\help"
If objFSO.FolderExists(folderSpec) Then
For Each file In objFSO.GetFolder(folderSpec).Files
LogToFile scriptPath & "\" & scriptBaseName & ".txt", file.Name & " bb"
I just want a way to output the filename based on the underscores. I know there is something like this:
I want to be able to do something like this
File = Split(File.Name,"-")
secondvalue = File(1)
firstvalue = File(2)
LogToFile scriptPath & "\" & scriptBaseName & ".txt", file.Name & " bb" & firstvalue & secondvalue