Click here to Skip to main content
15,887,822 members
Please Sign up or sign in to vote.
1.67/5 (3 votes)
See more:
i have .txt files in
C:\Users\Documents\Backup

i want to backup them to other directory for every 2 minutes
C:\Users\Documents\ArchiveUp

could anyone tell me how can i do it??
Posted
Comments
BillWoodruff 8-Dec-15 11:04am    
If you don't want to use Win Task Scheduler, what are you willing to use ? Do you want to write a stand-alone program, or windows service, to do this ? In C# ? With a GUI ?
Member 12181658 8-Dec-15 11:30am    
i want to do this automatic backup process through batch script because it's a coursewrok and i have tried schtask which was not successful
is there any other method which would be helpfull?
BillWoodruff 8-Dec-15 11:54am    
And, what script do you know of that provides timers for you to use ?
CHill60 9-Dec-15 7:17am    
A word of advice - if there is a tool or approach that you definitely don't want to, or can't, use then you should mention that in your questions.
That will prevent people wasting their time posting solutions that are not appropriate for your specific circumstances and leave your question in the "un-answered" queue - which increases the likelihood of getting an appropriate answer.
This advice is not specific to this forum by the way.

For the timing have a look at the Windows Task Scheduler[^]

As for the script to copy them, there are numerous examples available e.g. see this post[^]
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 8-Dec-15 10:50am    
Sure, a 5.
—SA
Member 12181658 8-Dec-15 10:55am    
i want to do an automatic backup through script apart from using windows task scheduler
is there any other way?
Sergey Alexandrovich Kryukov 8-Dec-15 11:13am    
Why "any other way"? Yes, of course there are different ways. Why?
Why not accepting this answer formally?
—SA
Member 12181658 8-Dec-15 11:35am    
i think ur answer is absolutely correct but As i'm on coursework its not allowed to do so.every thing should be done through script
If you don't want to use the Task Scheduler, use robocopy's "MOT" option:
robocopy:

/MOT:m :: MOnitor source; run again in m minutes Time, if changed.

robocopy "C:\Users\Documents\Backup" "C:\Users\Documents\ArchiveUp" /MIR /MOT:2

Specifying a Copy Schedule in Robocopy[^]
 
Share this answer
 
Comments
phil.o 8-Dec-15 13:38pm    
Good one, thanks :)
BillWoodruff 8-Dec-15 13:41pm    
+5 thanks, did not know RoboCopy could do that !
The script could be something like (.bat or .cmd file):
@echo off
robocopy "C:\Users\Documents\Backup" "C:\Users\Documents\ArchiveUp" /MIR

You can find more options for robocopy program by simply typing robocopy /?.

Then you can use the Windows Task Scheduler to schedule the execution of the script every two minutes.
 
Share this answer
 
Comments
Richard Deeming 8-Dec-15 12:44pm    
No need for the task scheduler - robocopy's MOT option will do the trick!
Specifying a Copy Schedule in Robocopy[^]

robocopy "C:\Users\Documents\Backup" "C:\Users\Documents\ArchiveUp" /MIR /MOT:2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900