Renaming and moving files within a .bat file in Windows Scheduler
Posted on 2015-01-09
I am trying to do two different tasks (not all in one .bat file). First, I have files that run and they are pre named with the correct date naming convention. How do I move (or copy) a file from the folder the windows scheduler outputs to, to another folder so someone can get the file? The file name changes daily because it has today's date in the name. Below is an example:
The file outputs here n:/mhortick/ named WEBE010915.ACT.TXT tomorrow that file will be named WEBE011015.ACT.TXT. Regardless of the name I need to move (or copy) it to another folder.
Second, how do I rename a file that comes out as a generic name. I want to use today's date but I want the year to be 15 and not 2015. Below is what I have for this already. It works, but the 2015 still shows and it is not what my client wants:
@For /F "tokens=2,3,4 delims=/ " %%A in ('Date /t') do @(
copy "N:\mhortick\TRAKNOTE.TAB" "G:\CLSINC\TRAK\WEBE"%All%"_001.note.txt"