DBAsupport.com Forums - Powered by vBulletin
Results 1 to 2 of 2

Thread: batch file to rename alert.log with the date

  1. #1
    Join Date
    Apr 2001
    Posts
    55

    Does anyone have a batch file (I'm on NT) that will rename the alert.log with the date added to it? I'm looking into writing this myself, but it is proving to be more problematic than expected. Hoping to save some time...

    Thanks
    -mcslain

  2. #2
    Join Date
    Sep 2000
    Posts
    362
    @ECHO Off
    FOR /F "TOKENS=1,2,3,4 DELIMS=/, " %%A IN ('DATE/T') DO SET DYNOM=%%A
    FOR /F "TOKENS=1,2,3,4 DELIMS=/, " %%A IN ('DATE/T') DO SET DYMON=%%B
    FOR /F "TOKENS=1,2,3,4 DELIMS=/, " %%A IN ('DATE/T') DO SET DYDT=%%C
    FOR /F "TOKENS=1,2,3,4 DELIMS=/, " %%A IN ('DATE/T') DO SET DYYR=%%D

    ren alert.log "Alert-"%DYNOM%-%DYMON%-%DYDT%-%DYYR%.log

    Hope this helps

    Anurag
    Appreciation is a wonderful thing;
    It makes what is excellent in others belong to us as well.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width