Robocopy By Date ?

Hello Gurus,
I need to backup a folder using the robocopy command. (I highly trust that command).
my problem is that I need to keep copies by DOW.
Meaning I need to have 7 folders Mon Tue Wed Thu Fri Sat and Sun.
and depending on the day ... I need to run the robocopy command like...

robocopy C:\MyDocs Z:\Tue\MyDocs /S /E /R:1 /W:1
if the day is tuesday...
Thanks a lot guys ...
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Wayne BarronAuthor, Web DeveloperCommented:
OK, I do not think that you can do this with RoboCopy alone.
You will need to save your RoboCopy as a .bat file
And add a Task in [Scheduled Task]

Take a look here
This gives all the information that you need for creating the Task.
(This was written for a Shutdown, but you use the same concept for the Backup)
You will want to create different Task for the Different Days.
And you will need to create the Different .bat files for the different days as well.
Better off to name them
That way it will be easier to keep track of your scheduled task that way.

Good Luck
Wayne BarronAuthor, Web DeveloperCommented:
You will want to choose to do yours [Weekly]
And then on the next page, choose the day that you are doing.
And then just repeat this task for each day of the week.

This is the best way to do it.
ammounpierreAuthor Commented:
I have seen many times that we could create variables in DOS... but I dont know how to...
can't we do that ? meaning create on the fly a variable that will hold "mon".."tue"...etc... ?
I am not so at ease with multiple scripts... you would have to monitor them....
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

Wayne BarronAuthor, Web DeveloperCommented:
If you ran each script like so
robocopy C:\MyDocs Z:\Tue\MyDocs /S /E /R:1 /W:1
And had the Task for it.
And each of the other days, then you should be fine.

What is there that needs to be monitored?

Having everything in one script.
You would have to do it like so

robocopy C:\MyDocs Z:\Mon\MyDocs /S /E /R:1 /W:1
robocopy C:\MyDocs Z:\Tue\MyDocs /S /E /R:1 /W:1
robocopy C:\MyDocs Z:\Wed\MyDocs /S /E /R:1 /W:1
robocopy C:\MyDocs Z:\Thur\MyDocs /S /E /R:1 /W:1
robocopy C:\MyDocs Z:\Fri\MyDocs /S /E /R:1 /W:1

That would be in one script.
You would have to find a way to loop through this and attach to the Day of the week.
And as for as I am aware of, I do not think that there is a way to do.

The method that I showed above, I have done on countless number of systems.
And it works flawlessly.
I even did it an atorney's office about 6 yrs ago.
And they are still using my same script that I wrote them back then.

Good Luck.
I hope you can find that DOS way, if you do.
Please post it here.

ammounpierreAuthor Commented:
Your method means that I would have to create 7 batch files monday.bat tuesday.bat etc...
right ?
and I would schedule a task to run monday.bat on mondays ...tuesday.bat on tuesdays etc...
So there would be 7 scheduled tasks to monitor...
Look at this batch file here.

Look at response No 2.  His batch file pulls the DOW out of the system date into a variable.  He then uses xcopy it to copy it to the DOW folder.  You can adapt that easy enough for your robocopy.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Wayne BarronAuthor, Web DeveloperCommented:
Good on dbrunton.

ammounpierreAuthor Commented:
perfect solution ! thanks a mil !
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows XP

From novice to tech pro — start learning today.