I need to take the original filename last portion (DDMMYY) and turn itīelow is a Windows batch script that will do just what you list in your question-if you'd like an explanation of what this script is doing, let me know and I'll add comments to the logic to clarify exactly if you're not sure based on what I have in it. I want to know if it is possible with a batch script to get the last file name part characters to switch positions so essentially YY and DD will swap places.Īdditionally, I need the other parts before the fixed YYMMDD to be replaced with static characters of MYNAME_TLD_EXT_ rather than what it may be before the switch, so the final result will be MYNAME_TLD_EXT_ and have NO file extension.įIL120_000112_DDMMYY => MYNAME_TLD_EXT_YYMMDD Please note that it willnot fit current need to get the renaming done using the current date with some command in that part of the file name. ![]() I need to take the original filename last portion ( DDMMYY) and turn it into YYMMDD. Here is the renaming scheme I’m searching for: Original filenames FIL120_000112_DDMMYY => MYNAME_TLD_EXT_YYMMDD In this example, using the above time mentioned hope.txt would be renamed to 'm currently stuck on an issue with a DOS batch script I’ve been working on, and I need help renaming the files. When %time% is used in a batch file, it displays the following format: 19:34:52.25. Additional information about what everything in this line means is found in the above date example. Finally, because we're renaming the file to only the hour and minute this example is only using the d and e token. However, instead of using the forward slash and space to break up the data, we're using a : ( colon) because the time uses this character. This command is similar to the above example. Time for /f "tokens=1-5 delims=:" %%d in ("%time%") do rename "hope.txt" %%d-%%e.txt In this example, using the above date mentioned hope.txt would be renamed to 09-02-2007.txt. When %date% is used in a batch file, it displays the date in the following format: Sun. This example also has a - ( hyphen) in-between each token to separate the month, day, and year in the file name.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |