I am writing a DOS batch program that, among other things needs to rename a file with a date stamp based on a format passed in part of an argument. i need to parse this format identifier from the argument (variable) to determine how to format the date stamp.
The variable will come is as: "FileNameFormatOtherStuff.extension" an example would be: "filenameccyymmdd.pgp" where ccyymmdd would mean to create a variable to later be used to rename a file to something like: "FileName20120816.pgp" i can receive various formats the key being the occurrence of a specific group of characters like: ccyymmdd or yymm or yymmdd etc... there are about ten combinations possible. In some cases the string could have the identifier in the middle like this: "FileNameccyymmdddMoreStuff.csv".
I have no problem with parsing a date and building the correct filename, what i do need to determine is the following items: the length of the entire string, the starting position of the format identifier within the string the ending position of the format identifier and the position of the "." which is not always at the end of the format identifier.
I have been trying to use the FOR/f command and am failing miserably.....HELP!
Thanks! - Jennifer