| 1. |
Solve : bat file processing a file with a date as part of the file name? |
|
Answer» I have a file aaa-bbb_yyyymmdd - yyyymmdd = current date. The file is really a logfile, created new each day at 12 AM with the current date as part of the file name. I have displayed the %DATE% variable in the BAT file and it You can use this notation for the current date: %date:/=% to strip out the slashes. Code: [Select]aaa-bbb_%date:/=% Good LUCK. Quote from: SIDEWINDER on September 25, 2008, 06:20:11 PM You can use this notation for the current date: %date:/=% to strip out the slashes. The notation WORKS like this %string:cat=dog% That MEANS: in %string% remove every occurrence of "cat" and put "dog" in its place. In the string variable whose name appears between the first percent sign and the colon, replace whatever is between the colon and the equals sign with whatever is between the equals sign and the right hand side percent sign. So %date:/=% replaces / with nothing, and %date:/=-% replaces / with a - (minus sign or hyphen). Many thanks.. that helped me a lot... Now, to ramp my issues up a notch... is there something available for date manipulation? E.G. I have a file aaa-bbb-20080930 which represents a file created on 20080930. I execute a process on 20081001 which needs the prior day's file which is aaa-bbb-20080930 . If I merely SUBTRACT 1 from today's date I'm not ending up with what I want... |
|