New
#31
I have just ordered a new Toshiba P300 3TB drive to sit alongside the X500 5TB data disk.
I plan to do a daily (or possibly twice-daily) backup to this additional drive of documents, music, photos and videos using Robocopy running as a batch file in Task Scheduler.
The System Disk was cloned this morning - plan to do this monthly.
This should cover most bases!
Art
Paul,
I can't find the thread but it was based on my own backing up scripts
Edited 31/3/24
This revised script is significantly better than my old one. The new switches deal with, for example, the changeover from GMT to BST [Daylight saving time] that we experienced earlier today. The changes were discussed in post #17 of another thread.
My revised Sample RoboCopy backing up script.bat
Code:Set BackupDrive=G: RoboCopy "D:\Desktop" "%BackupDrive%\Desktop" /S /R:10 /MT:32 /DST /FFT /NDL /DCOPY:DAT /XA:SH /MIR RoboCopy "D:\Documents\Work" "%BackupDrive%\Documents\Work" /S /R:10 /MT:32 /DST /FFT /NDL /DCOPY:DAT /XA:SH /MIR RoboCopy "D:\Documents\Home" "%BackupDrive%\Documents\Home" /S /R:10 /MT:32 /DST /FFT /NDL /DCOPY:DAT /XA:SH /MIR RoboCopy "D:\Documents\Cooking" "%BackupDrive%\Documents\Cooking" /S /R:10 /MT:32 /DST /FFT /NDL /DCOPY:DAT /XA:SH /MIR RoboCopy "D:\Documents\Friends" "%BackupDrive%\Documents\Friends" /S /R:10 /MT:32 /DST /FFT /NDL /DCOPY:DAT /XA:SH /MIR RoboCopy "D:\Documents\House" "%BackupDrive%\Documents\House" /S /R:10 /MT:32 /DST /FFT /NDL /DCOPY:DAT /XA:SH /MIR RoboCopy "D:\Documents\Odds N Sods" "%BackupDrive%\Documents\Odds N Sods" /S /R:10 /MT:32 /DST /FFT /NDL /DCOPY:DAT /XA:SH /MIR RoboCopy "D:\Documents\Suppliers" "%BackupDrive%\Documents\Suppliers" /S /R:10 /MT:32 /DST /FFT /NDL /DCOPY:DAT /XA:SH /MIR Pause to look at the results until you are confident in the file. This line makes the batch file stay open when it has finished its job. ∷ Put two colons in front of Pause after you decide you no longer want it to remain open when it has finished. Or just delete the Pause line and this line.
Art then tailored that original version to his own needs.
Denis
Last edited by Try3; 3 Weeks Ago at 06:28.
Thank you @Denis, it is very much appreciated. The reason I asked is because I intend to write a batch script to backup certain folders and files, and was thinking of looking into RoboCopy to achieve this. Like other scripts that I have written, I intend to tag the date and time [ in UK format ] to the filename. I need to investigate the RoboCopy parameters etc first. I will have a proper look at doing this over the weekend.
Written with the help of Denis (aka Try3).
I have a version running on mine and my wife's laptops - saving to a 256GB SD card which we permanently leave in the SD Card slot.
For example, on my wife's PC it runs through Task Scheduler every 3 hrs from 10:00am each day (so at 10:00, 13:00, 16:00, 19:00, 22:00). That way, the most out-of-date anything will be is 3 hrs. My backup is set up in a similar manner.
On my wife's pc, the SD card has been assigned M: drive (I just chose a letter away from the usual C - H drives) really, it could equally well be Z:
The batch file is written in NOTEPAD (ideally save a copy as filename.txt) so you can look at the file and edit it if necessary.
First line of the batch file says:
Set BackupDrive=M:
... and an example line from her batch file is:
ROBOCOPY "D:\WORK" "%BackupDrive%\Documents\WORK" /s /R:2 /MT:1 /DCOPY:DAT /XA:SH /MIR /W:2 /XJ
[if you want explanations of what these switches do, have a look at this post (#28) in this thread "New laptop - empty m.2 socket - doesn't recognise SSD"]
Just make sure that you accurately know the exact path to the documents you wish to copy - e.g. D:\Work in the above example.
It helps if you know DOS commands - just jump into a Command Window and use the 'cd' command (change directory) to navigate to the relevant folder - DOS will then show you the full path name. BTW the command 'cd..' takes you up the directory structure 1 level, so if you are at C:\Documents\Scans then cd.. will take you back to C:\Documents. To change to another folder - e.g. the folder 'Games' which is in C:\Documents - use the command 'cd Games' from the command prompt (assuming you are already in C:\Documents. Use the 'dir' command to display the contents of that particular folder and when finished just use the command 'exit' to quit the Command Window. NOTE the spaces in the above commands - they are important. Apologies if you are already familiar with DOS.
Denis suggested creating the corresponding folders on the SD card first - so before running the batch file, make sure you have already created (in this particular example) M:\Work. The folder names don't need to be the same - for example D:\WORK does not have to map to M:\WORK, it could equally well map to M:\OFFICE or M:\Part-Time Work, the path in the Robocopy command says where to fetch stuff and where it is going.
The last line of the batch file says:
'Pause' (on its own line)
This halts the batch file at the end of the run - and waits for you to press a key to exit. This is useful when debugging and can be removed from the batch file once you are happy it is doing what you expect it to do (you would have to edit the Notepad .txt document and then resave over the old .bat file) [or you could remark the like by using two colons - like this '::Pause'.
When you are happy with the batchfile (and saved a .txt copy for editing purposes) save a second copy but use the file extension .bat instead (and check that it hasn't saved as filename.bat.txt, it should just be filemane.bat)!
Then create a basic task with task scheduler to run the .bat file whenever and as often as you like.
I hope this helps.
I don't profess to be an expert in any manner of means but if you get stuck, I'll try to help if I can with my limited understanding but Denis (aka Try3) is your man!
Art
EDIT: I took so long to write this and find all the links, get my wife's pc, etc, that Denis jumped in ahead of me!
He's the main man - he'll sort you out!
A
Last edited by ArthurDent; 10 Jul 2020 at 13:39.
Hello @Denis,
I found your excellent post with an explanation of the parameters here . . .
New Laptop - empty m.2 socket - doesn'r recognise SSD - POST #28