[SOLVED] script for copying data from one location to another

Mar 12, 2019
6
0
10
Hi Everyone

Can anyone out there help me write a script to run via task scheduler that would copy a file from one location and place it in another?

we need to do a backup of a database backup and so far this task is done manually but would rather use task scheduler with a script that can run every day at a specific time. That would copy that file which is not very big and paste it in another location that location may be another pc or a attached HDD.

any ideas are greatly welcomed

thanks
 
Solution
robocopy is great for your situation and this is the ultimate guide to use learn it
and this link has typically the job you want to do
https://stackoverflow.com/questions...-copy-files-from-one-folder-to-another-folder
and if you found any problems with learning robocopy , you can try any of it's GUI alternatives, you have peersync , teracopy ,gs richcopy 360 and secure copy quest as an examples
I'm using Microsoft' RobotCopy, executed from a script twice a week,
Bash:
@echo off
echo This script will be executed twice a week, to backup following folders:
echo "D:\MyStuff -> \\Server\MyStuff\Backup"

rem /mir   Mirror directory structure
rem /log+: Append log to file
rem /log:  Create log file
rem /np    Do not write progress to file
rem /tee   Display on console as well
rem /b     Backup mode - reset archive bit on copied files
rem /R:2 /W:2    Retry 2 times failed copy operations, wait 10 seconds between them
rem /xf    Exclude files (do this so that giant files at the root folder do copy last)

robocopy D:\MyStuff\ \\Server\MyStuff\Backup /mir /R:2 /W:2 /log+:C:\Temp\Backup2Server.log /np /tee

rem pause
You may want to pay attention to "/mir" flag if copying folders.
 
  • Like
Reactions: TideMozer
D

Deleted member 14196

Guest
Do not use /mir unless you know EXACTLY what you are doing. If you muck it up it’s a really easy way to wipe out lots of data real fast

All he needs is a simple Robo copy batch file and the use task manager to run it at certain times
 

TideMozer

Reputable
Jan 18, 2020
10
5
4,525
robocopy is great for your situation and this is the ultimate guide to use learn it
and this link has typically the job you want to do
https://stackoverflow.com/questions...-copy-files-from-one-folder-to-another-folder
and if you found any problems with learning robocopy , you can try any of it's GUI alternatives, you have peersync , teracopy ,gs richcopy 360 and secure copy quest as an examples
 
Solution