Renaming files by creation date

March 25, 2009 at 13:30:02
Specs: Windows XP
I have a batch file created that renames files from current file to a filename like mm-dd-yyyy.dem which works great when we recieve files on Tuesday-Friday for the previous day as there only for one days worth of files. The problem I have is we get three days worth of files on Monday from over the weekend. On Mondays I need to rename those files to the same format mm-dd-yyyy.dem but with there individual days, i.e. fridays file will have one date, sat another, and sun another. I am trying to accomplish this using a batch file in dos nt command line using xp I currently have the following commands which allow the renames for single days.

H:
cd \ngrftp
IF EXIST rb01*.txt ren "rb01*.txt" "%date:~4,2%%date:~7,2%%date:~-4%%.DEM"
pause
IF EXIST rb02*.txt ren "rb02*.txt" "%date:~4,2%%date:~7,2%%date:~-4%%.INS"
pause
IF EXIST rb03*.txt ren "rb03*.txt" "%date:~4,2%%date:~7,2%%date:~-4%%.PRO"
pause
ftp -s:g:\demographic_scripts\D_NGR_TEST\D_NGR.txt


The txt file runs basically logs into our unix box and runs a few mget commands to get the files.

Thanks!


See More: Renaming files by creation date

Report •


#1
March 25, 2009 at 23:32:30
[1] I don't see anything related to date created.

[2] What's the question?


=====================================
If at first you don't succeed, you're about average.

M2


Report •

#2
March 26, 2009 at 05:31:08
Thats what Im trying to figure out a way to rename files but trying to have the batch file test to see if its mon, to rename all files going backwards. i.e.

Its Mon 3-23 there are a total of three files one for each previous day RB01_0320_0000.txt, RB01_0321_0000.txt, and RB01_0322_0000.txt. I need for thee batch file to rename each one those repective dates 03-20-09.dem, 03-21-09.dem, and 03-22-09.dem. This happens each monday where there is a need to rename the three previous days files. The only way I can figure to do this is by creation date. All ideas are greatly appreciated!! Hope this helps, THX!


Report •

Related Solutions


Ask Question