Backing up your Files Easily

Carrying on from the recent thread about the worldwide computer outage and the mention of backing up. here is a quick and easy way to back up all your files onto a USB thumb drive or hard disk.

It makes certain assumptions:

That you use C: drive for your files.
That you use the M$ default directories to store your files (all is not lost if you don’t)
That you know how to copy and paste
That you know how to change a file extension.

The following code needs to be copied into a text editor like Notepad then it needs to be saved onto a thumb drive or HDD as, say, “Backup.bat” note the extension (last three characters) is not .txt (the default). As a safety measure it will not run on C drive

As it stands double clicking on it should run BUT it will show you what it will do without actually doing anything (except create a Backup Text date file). To make it work load it into Notepad by right clicking and cursor down to “Edit in Notepad” and only remove * “/L”* from the end of the line which starts with “Robocopy”. Another safety measure.

The file will make no changes to your computer so at worst you will mess up a thumb drive.

OK the code:

@echo off

set "TargetDrive=%~d0"

REM Check it is not C: Drive

if %TargetDrive%==C: (
	echo.
	echo DO NOT RUN THIS ON C: DRIVE
	echo.
	pause
	goto :eof
)

setlocal  enabledelayedexpansion

echo.
echo    Backing up Important Files to Thumb Drive...
echo.

for %%f in (Documents, Pictures, Videos) do (

Robocopy "%userprofile%\%%f" "%TargetDrive%\%computername%\%username%\%%f" /r:1 /w:3  /s /xo /L

)

rem          Date stamp latest back up
echo.
echo Backed up on %date% at %time% > "%TargetDrive%\Backup Date.txt"
echo.
echo         That's the lot...
echo         Thank you and Goodnight!
echo.

Pause

endlocal

Make sure you copy it all, it starts with @echo off and ends with endlocal.

To run it just double click if you are using an administrator’s account otherwise right click and select “Run as Administrator”. Once you have removed the “/L” backups are just a double click away, no more is needed

Works on any Windows computer for any account.

Will write another post later if there is a need on how to make it find your directories if you don’t use Windows created ones

Any questions? :icon_wink:

2 Likes

Doesn’t Windows have a backup system built in? On Mac we have Time Machine - just plug in a USB drive, set it up in Time Machine preferences and it automatically backs up all your files on a regular basis. You can even have multiple drives for contingency.

Of course it does BUT it wants you to use OneDrive and some people are wary of relying on the cloud.

Actually it is bloody annoying because it constantly reminds you to set up OneDrive to back up your files.

There are also innumerable free Windows programs that back up just about anything including mirrors of your entire drive but nothing is as quick or convenient as M$DOS.

See here:

Not the same then Bruce - Time Machine lets you back up to your own drives. I’d not want my data on their servers/in the cloud.

Don’t know why anyone uses windows now tbh. Linux or Mac are the only decent options imo

All these inbuilt systems are just bloatware really, you should be able to chose.

There always a few who want to use weird systems like Linux and Macs but I am afraid they remind me of those who bought Betamax recorders (“Betamax is so much better than VHS”) and ended up with a very expensive clock.

Those have their place but in a small niche market. There is nothing you can’t do with a Windows machine.

June 2024 stats:

I appreciate this explanation, although like Azz, I did wonder if it was a tad much since I can just just put everything on a memory stick, and voila. However since I have a Windows laptop and a Chromebook, and also not a fan of the Cloud, I’ll have a go following these instructions later today and see how I get on. :+1:

I used to have a Mac, but, while it was simple enough to use and back up with Time Machine, now I don’t have it…I can’t access anything from years ago on my Mac configured external drive, which is disappointing.

Obviously you can just select and drop using two windows of File Explorer, but you have to do the same thing every time, the advantage of a batch file is that once set up it is a no brainer to use every time, it decides if the file is newer etc.

If you want to you can exclude particular files or whole directories or only copy files of a certain age. However to make it simple my batch file copies everything which takes some time the first time it runs but there after it only copies new or changed files…

I am a big fan of batch files but they date back to the days of DOS and as I said there are GUI programs that do the same job but nothing works quicker than a batch.

I have three Teta Bytes. So far only one is still quite just well a fraction of it.