I think im overcomplicating something simple but im looking for a VB.Net code to “filter” file names.
Scenario:
My company has a folder on the server with over 65,000 files on it. The new machine that reads those files is case sensitive and only accepts “*.S4” file extensions.
So, I need to convert all the file names to “*.S4” but I’d like the option to replace each file with a pattern I Specify.
For example:
Find > test.s4
Replace > test_1.S4
Using Patterns:
Find > *.s4
Replace > *_1.S4
Heres the code I have so far (doesnt work):
'Inputs:
Dim Filename As String = "ThisIsAnExample.s4"
Dim Find As String = "*.s4"
Dim Replace As String = "*.S4"
Find = Find.Replace("*", "(.*)")
Replace = Replace.Replace("*", "(.*)")
Dim rgxExp As New System.Text.RegularExpressions.Regex(Find)
MsgBox(rgxExp.Replace(Filename, Replace))
I know its possible, I wrote a similar script in Javascript once.
Can’t you do this?