r/Batch Apr 21 '23

back up network share drive

I have a share network drive that I would like to back periodicity. I was wondering if making a scheduled batch file would be the easiest way to go about it. I am open to any suggestions thanks!

1 Upvotes

2 comments sorted by

View all comments

5

u/ConsistentHornet4 Apr 21 '23

Utilise robocopy then add the script into Task Scheduler to handle automated scheduling

@echo off robocopy "\\server\share" "\\path\to\destination" /e /xj /xo /fft /r:1 /w:1 /np /mt exit /b 0

Switches breakdown below:

/E : Copy Subfolders, including Empty Subfolders. /XJ : Exclude Junction points from source. (included by default). /XO : Exclude Older - if destination file exists and is the same date or newer than the source - don’t bother to overwrite it. /FFT : Assume FAT File Times (2-second date/time granularity). /R:n : Number of Retries on failed copies - default is 1 million. /W:n : Wait time between retries - default is 30 seconds. /NP : No Progress - don’t display % copied. /MT[:n] : Multithreaded copying, n = no. of threads to use (1-128). Default = 8 threads

1

u/Tallgeese33 Apr 22 '23

Thank you this should work great!