I'm not sure if this would be the right area to put this in - please move where necessary if needed. Apologies in advance.
Okay so for all of you developers out there - I'm one of the guilty ones who is very lazy at backing up my files and never really doing it often. Now I'm needing to change my ways and provided a better way of doing it and thought I'd share it with you all just in case you may need/want it.
So with that said, lets begin.
Network Drive Tutorial
Spoiler for Network Tutorial:
Backup to a Network Drive
This is really simple, surprisingly. If you're running Windows it makes it even easier. I'll update this tutorial on how to get it running on OS X and Linux if needed so just ask me.
Firstly download Vista Subst for Windows [Only registered and activated users can see links. ]
Now run it, install it and when you run the .exe file you should see this:
Spoiler for Vista Subst:
Now for me, as you can see I'm using google drive. So all I have to do is type this into the bar at the bottom and assign it a drive letter:
Spoiler for Vista Subst:
Make sure you tick the box to assign the drives on Windows Startup. Makes your life a lot easier.
After that, you're ready to make the .bat script to copy all your files across. I put one together myself for you guys to edit how you like.
Open up any text editor. (I personally used Notepad++) and put in this code:
echo Backup Script
echo Press any button to start backup.
xcopy "C:\Directory-To-Server-Folder" "G:\Directory-To-Networked-Drive\" /D /E /C /R /H /I /K /Y /O
echo All files complete.
Modify that as needed. Remember the letter you assigned your networked drive to and in my case it was "G:" so you're going to need to change it to whatever you assigned it to.
After that save the script as "filename.bat" < make sure you have .bat at the end and run the script! It should successfully copy over the files.
External Drive Tutorial
Spoiler for External Tutorial:
Backup to an External Drive
Okay this is all completely automated which is fun and I've also put together a batch script to run for this aswell. It will automatically pick up your mounted drive and copy all files to this drive.
Open up a text editor (I used Notepad++) and input this code:
for /F "tokens=1,2" %%a in ('wmic logicaldisk get DeviceID^,DriveType') do if %%b equ 2 set USBDrive=%%a
if not defined USBDrive (
echo USB not connected
) else (
echo USB on drive %USBDrive%
echo Press any button to copy to %USBDrive%
xcopy "C:\Directory-To-Server-Folder" %USBDrive% /D /E /C /R /H /I /K /Y /O
Save the file as "yourfilename.bat" and run it!
After reading the tutorials and if you use any of these methods then you can use the "Windows Task Scheduler" to run these scripts anytime you want daily/weekly etc.
While this is very helpful, I recommend to use git such as GitHub or BitBucket. Not only are they reliable, but allows you to keep track of progress and revert changes at anytime to your work. Also increases productivity among group based projects.