Windows backup: append day of week to filename?

T

Terry R.

The date and time was 7/2/2008 9:48 PM, and on a whim, darius pounded
out on the keyboard:
I want to make a backup with multiple schedules, for each weekday. Is
there a way to make it automatically append the day of week to the backup
filename, like backup-MON, backup-TUE, backup-WED, etc. (The backup
files are overwritten each week, but at any time, I have the backups of
the last 5 weekdays.)

I guess I could make 5 different backup jobs and give the filename I
want, but it's a pain. Plus if I need to make changes (add or remove
folders to the job), I have to go through all 5 jobs.

Hi Darius,

I would think using the /f command line parameter and using some DATE
variables you could accomplish it. Pegasus will probably have what you
need.

--
Terry R.

***Reply Note***
Anti-spam measures are included in my email address.
Delete NOSPAM from the email address after clicking Reply.
 
D

darius

I want to make a backup with multiple schedules, for each weekday. Is
there a way to make it automatically append the day of week to the backup
filename, like backup-MON, backup-TUE, backup-WED, etc. (The backup
files are overwritten each week, but at any time, I have the backups of
the last 5 weekdays.)

I guess I could make 5 different backup jobs and give the filename I
want, but it's a pain. Plus if I need to make changes (add or remove
folders to the job), I have to go through all 5 jobs.
 
P

Pegasus \(MVP\)

Terry R. said:
The date and time was 7/2/2008 9:48 PM, and on a whim, darius pounded out


Hi Darius,

I would think using the /f command line parameter and using some DATE
variables you could accomplish it. Pegasus will probably have what you
need.

Since I hear my name mentioned, I suppose I have to reply!

To the OP: What is your current backup command?
 
D

darius

Since I hear my name mentioned, I suppose I have to reply!

To the OP: What is your current backup command?

Hi

I'm just using the GUI. (system tools / backup)
 
P

Pegasus \(MVP\)

darius said:
Hi

I'm just using the GUI. (system tools / backup)

If you create a new backup run with the GUI then you have to
type the day of the week when prompted for a destination file
name.

If you get the GUI to schedule the backup run for the various
days of the week then you need to modify the backup task
in the Control Panel / Task Scheduler. A good starting point
would be to post the command line you see under the properties
of that task.
 
D

darius

If you get the GUI to schedule the backup run for the various
days of the week then you need to modify the backup task
in the Control Panel / Task Scheduler. A good starting point
would be to post the command line you see under the properties
of that task.

Thanks. I think I figured it out. For those interested:

1) setup your backup job and schedule it using the GUI per usual.

2) go to control panel / scheduled tasks and double click on the backup
task you created.

3) Copy the Run field. It should be something like
c:\windows\system32\ntbackup.exe followed by long command line arguments.

4) create a file using notepad and save it somewhere as "backup job.cmd"
Substitute 'backup job' with whatever name you like.

5) add this as first line

set dotw=%date:~0,3%

What this does is set dotw to the first 3 letters of the date variable.
This assumes your date format starts with the day of the week. If not,
you need to play with this. Run cmd and type

echo %date%

and

echo %date:~0,3%

to see what you get

6) paste the line you copied in step 3) on next line

7) edit the line you just pasted so that the part that says

/f "something.bkf"

become

/f "something-%dotw%.bkf"

8) Change the Run field in Step 3) so it points to the .cmd file you just
created. (use the browse button.)

Voila
 
P

Pegasus \(MVP\)

darius said:
Thanks. I think I figured it out. For those interested:

1) setup your backup job and schedule it using the GUI per usual.

2) go to control panel / scheduled tasks and double click on the backup
task you created.

3) Copy the Run field. It should be something like
c:\windows\system32\ntbackup.exe followed by long command line arguments.

4) create a file using notepad and save it somewhere as "backup job.cmd"
Substitute 'backup job' with whatever name you like.

5) add this as first line

set dotw=%date:~0,3%

What this does is set dotw to the first 3 letters of the date variable.
This assumes your date format starts with the day of the week. If not,
you need to play with this. Run cmd and type

echo %date%

and

echo %date:~0,3%

to see what you get

6) paste the line you copied in step 3) on next line

7) edit the line you just pasted so that the part that says

/f "something.bkf"

become

/f "something-%dotw%.bkf"

8) Change the Run field in Step 3) so it points to the .cmd file you just
created. (use the browse button.)

Voila

Well done! (This is actually a bit of an FAQ)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top