What are the challenges you face when working across database platforms? Take the survey

Backup Folder

guantguant Posts: 14
edited July 15, 2009 12:23PM in SQL Backup Previous Versions
Ok, I'm a noob here but have a pretty basic question I think. In sql backup I'm going to create a daily backup job and I want to keep up to 90 days worth on disk. Is there anyway that you can automatically create a new folder for each backup so I could put the date on the folder and have that days backup go into that folder, then the next, and so on....This way things would be better organized instead of having one folder with tons of backup files

Thank you!


  • Options
    Hi Guant,

    If I understand correctly, you want to create a folder (with date) and put all the backup files for that particular date into this folder.

    If I have understood your requirement correctly then you can use tags for this. You can set default backup folder path using tags via Tools > Server Options .

    For your requirement you can use a tag like in below script:

    EXECUTE master..sqlbackup '-SQL "BACKUP DATABASE [Test] TO DISK = ''C:\temp\sql2000\<DATETIME yyyymmdd>\<AUTO>.sqb'' WITH INIT"'

    This will create a folder (with yyyymmdd as its name) and put the backup files in it. If the folder doesn't exist then SQL Backup will create it or else it will use the existing one.

    Priya Sinha
    Project Manager
    Red Gate Software
  • Options
    Thank you! That did the trick!!
Sign In or Register to comment.