Batch file to rename files?

osaddictosaddict London, UK
edited April 2008 in Science & Tech
Right, I have NTBackup on the go - backing up to a HDD - It seems it basically deletes the previous nights backup and then just creates a new one.

So, I could rename the existing file and then when it looked to create a new one it would see a file with the name it was trying to create didn't exist... great!

So I thought I could write a batch file which would rename 'MorningBackup.bkf' to 'MorningBackup_GETDATE.bkf

So, any ideas how I rename a file through a batch file, and further still, how the renaming can be based on the date - i.e. like the sql getdate() function ?!

(Or have I missed something in NTBackup that would cater for this already lol)

Comments

  • kryystkryyst Ontario, Canada
    edited April 2008
    To rename a file through a batch file you just use the same commands you would issue through dos.

    But what I would suggest you do is instead of having just one scheduled nt job that runs every day. Make a seperate job for each day and just have that job save to a seperate folder.
  • osaddictosaddict London, UK
    edited April 2008
    That's an interesting take on it Kryyst - I could effectivly have our 2 week rotation based on 10 simple scheduled jobs Monday 1... to Friday 2 as folder names or something and it would sort it out.

    I tried working my way through this:
    http://www.experts-exchange.com/Storage/Removable_Backup_Media/Q_22408339.html

    Earlier but got a little lost - in principal it could be an elegant solution - rename the file with the date it was made, then archive in to folders then delete folders.

    Your way is simpler though, and something I can guarantee will work! (when I've implemented it that is!)
Sign In or Register to comment.