I need to rename files generated automatically, truncating a timestamp at the end.
Files are named "abcd_efgh_jklm_21.04.2015.csv", with the numbers being today's date in german culture spelling and the "abcd"-parts one or more plain text parts. German culture uses . to separate the date parts, and that makes creating the rename instruction a problem (I think). Target name should be "abcd_efgh_jklm.csv" - remove last underscore and everything following it.
A real life example for a name could be
CompanyA_Sales_Forecast_ThirdRevision_21.04.2015.csv
Here we have four word-parts, and the date part which should be zapped out. Result would be:
CompanyA_Sales_Forecast_ThirdRevision.csv
I read How does the Windows RENAME command interpret wildcards? and think I understood it mostly, but I cannot get it to work. Best I got is
ren *.csv *_.csv
creating "abcd_efgh_jklm_.csv". This is close, but I need to get the last underscore removed also. I cannot figure that out.
Any advicde?