Link to home
Start Free TrialLog in
Avatar of noble123_2000
noble123_2000

asked on

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

ASKER CERTIFIED SOLUTION
Avatar of ahoffmann
ahoffmann
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of SysExpert
Not sure if Move is the correct command, I would think that ren  ( rename )  would be more appropriate.

I hope this helps !
Avatar of noble123_2000
noble123_2000

ASKER

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.