Urgent :Batch file for rename and copy the log file

Hi all,
I have a log file called "hr_xms_interface_vb.log" in D:\hr_xms_prog.
I have batch file which runs every day and gives me this log file (hr_xms_interface_vb.log).
That part works fine.

 But now i want to copy this log file to D:\hr_xms_prog\hr_xms_interface_log_backup folder.
and to rename it as hr_xms_interface_vb_001.log(For back up purpose). Next time when i run the batch file, i want the latest log file as hr_xms_interface_vb_001.log and the previous log file as(old log file) hr_xms_interface_vb_002.log. and so on.
I have to keep 5 days log file as back up. So in 6 th time,hr_xms_interface_vb_005.log has to be deleted and all others to be renamed correspondingly.

Could you please help me to write a batch file for doing this?

Thanks in Advance.
Noble

noble123_2000Asked:
Who is Participating?
 
ahoffmannCommented:
del  D:\hr_xms_prog\hr_xms_interface_log_backup\hr_xms_interface_vb_005.log
move D:\hr_xms_prog\hr_xms_interface_log_backup\hr_xms_interface_vb_004.log D:\hr_xms_prog\hr_xms_interface_log_backup\hr_xms_interface_vb_005.log
move D:\hr_xms_prog\hr_xms_interface_log_backup\hr_xms_interface_vb_003.log D:\hr_xms_prog\hr_xms_interface_log_backup\hr_xms_interface_vb_004.log
move D:\hr_xms_prog\hr_xms_interface_log_backup\hr_xms_interface_vb_002.log D:\hr_xms_prog\hr_xms_interface_log_backup\hr_xms_interface_vb_003.log
move D:\hr_xms_prog\hr_xms_interface_log_backup\hr_xms_interface_vb_001.log D:\hr_xms_prog\hr_xms_interface_log_backup\hr_xms_interface_vb_002.log
copy hr_xms_interface_vb.log D:\hr_xms_prog\hr_xms_interface_log_backup\hr_xms_interface_vb_001.log
0
 
SysExpertCommented:
Not sure if Move is the correct command, I would think that ren  ( rename )  would be more appropriate.

I hope this helps !
0
 
noble123_2000Author Commented:
hi all,
Thanks Ahoffmann and SysExpert for your fast reply.
Ahoffmann , Your solution is Perfect and thanks a lot!

SysExpert , Move works fine for me...

Thanks all
Regards
Noble.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.