Honestly I did not know how to frame this question because I am not sure what the most correct terminology here should be.
I created a script that renames all files in a defined folder path according to a naming convention list in another tab.
for example,
A file named ABC.example.txt.1234.txt will be renamed example.txt. So far is good, and the script works great. But now we have a bit of a new scenario with more variables that I need to consider. I have the following naming convention.
This time the outbound needs to extract the values from inbound.
A file named APX.example_12345678_12345678_123456.txt.1234.txt will be renamed example_12345678_12345678_123456.txt
To simplify my question, what is the best approach to achieve the following results:
Dim oldFile, pattern, newFile
oldFile = APX.example_12345678_12345678_123456.txt.1234.txt
pattern = example_*.txt
newFile = 'DO SOMETHING TO RESULT IN example_12345678_12345678_123456.txt
The code should be valid for:
Dim oldFile, pattern, newFile
oldFile = ABC.example.txt.****.txt
pattern = example_.txt
newFile = 'DO SOMETHING TO RESULT IN example_.txt
any suggestions are appreciated!
I created a script that renames all files in a defined folder path according to a naming convention list in another tab.
for example,
Inbound | Outbound |
ABC.example.txt.****.txt | example.txt |
A file named ABC.example.txt.1234.txt will be renamed example.txt. So far is good, and the script works great. But now we have a bit of a new scenario with more variables that I need to consider. I have the following naming convention.
Inbound | Outbound |
APX.example_********_********_******.txt.****.txt | example_*.txt |
This time the outbound needs to extract the values from inbound.
A file named APX.example_12345678_12345678_123456.txt.1234.txt will be renamed example_12345678_12345678_123456.txt
To simplify my question, what is the best approach to achieve the following results:
Dim oldFile, pattern, newFile
oldFile = APX.example_12345678_12345678_123456.txt.1234.txt
pattern = example_*.txt
newFile = 'DO SOMETHING TO RESULT IN example_12345678_12345678_123456.txt
The code should be valid for:
Dim oldFile, pattern, newFile
oldFile = ABC.example.txt.****.txt
pattern = example_.txt
newFile = 'DO SOMETHING TO RESULT IN example_.txt
any suggestions are appreciated!