I need to either write a batch file or a vbscript that will rename files. I need to keep everything in the file name up to the second “.” but delete what comes after the second dot.
This is a sample of what the file names look like:
nnnnnnnnnnnnnnnn.xxxxxxxx.dddddddddd.pdf
n= 16 numbers 0-9x= date in this format ex:02232008d= 10 numbers 0-9, this is the part of the file name that I want to delete.
I need the d’s from the sample above to be deleted but keep the rest of the file name the same. I need to be able to run this batch file on a folder that contains about 3,000 pdf files. It can either be put right back into the same folder or outputted into a different folder.
In VBScript, you can use something like
You would run it in a batch file thus, redirecting output to a log file
This assumes that you can simply rely on the period to delimit the parts of the file name rather than the specifics of the format of the delimited parts.
To rearrange the date, which I think is in the
parts(1)array element, you can simply extract each bit of the string because it’s in a specific format:so when rebuilding the filename, you can replace
parts(1)with the new formatted date