Broken Remote

November 3, 2008

Backing up your data using Robocopy: Redux

Filed under: software, windows — Tags: , — Broken Remote @ 2:12 pm

Some time ago, I wrote a post on how to back up your data using an effective batch script that utilizes a file copy utility called Robocopy. Turns out that’s a very popular post, so I want to offer a less hassled method of doing this for the less technically adept.

So a quick recap on Robocopy: It’s a command line utility that allows you to easily copy files from one place to another. Why is this better than just using the windows right click > copy menu to move your files? There are lots of reasons:

  • You can keep logs of what you’ve backed up
  • You can restart in the middle of a failed data copy
  • It’s most likely a lot faster
  • If one file has an error, the entire copy does not fail
  • You can do incremental backups. If you have a lot of data this means that it’s not going to re-copy your entire MP3 collection if you do the same backup twice in a row. This saves a lot of time

In short, it beats a basic copy all around. The primary problem is Robocopy isn’t a simple program that you can just download and easily use. You have to use a command line interface. But no worries, I’ve written one for you!

Before I list the script, there are some important things to know:

  1. WIndows Vista users, you will use a special version of the script that excludes junction points. Vista has some strange folder virtualization that makes it compatible with old Windows XP user profile paths. If you don’t use the correct script, it will get stuck in an infinite loop on certain folders, notably “Documents and Settings/username”.
  2. Windows XP users, you cannot use the exclude junction point version as Robocopy probably won’t recognize that command. I’ve posted both versions below
  3. Windows XP users, you have to install the Windows 2003 Server Resource Kit in order to use Robocopy. Vista users, it’s already installed on your operating system.

So without further ado, here are two backup scripts.

Instructions:

Copy and paste the entire text of the correct version of the script below into notepad (Start > Programs > Accessories > Notepad).

Save that file as “backup.bat”, including the quotes, to somewhere you will remember, like your Windows desktop.

Go to that location and make sure you see a file named “backup.bat”, this time without the quotes. It should have a weird icon with a gear on it or just a plain white window.

Double click on the file to run it. A black window should pop up. Just follow the on screen instructions.

Important note: You must create the backup directory before you run the backup. For example, if you wanted to backup C:/Users/smith to D:/myProfileBackup, you should go to My Computer > D:/ and create a new folder called myProfileBackup before you run the script or you will get an error.

Leave me a comment if you have any questions!

Windows Vista Users:

@ECHO off

ECHO.
ECHO    * – - – - – - – - – - – - – - – - – - – - – - *
ECHO    *                                             *
ECHO    *     Robocopy Backup Utility for Windows     *
ECHO    *     by Broken Remote via                    *
ECHO    *     brokenremote.wordpress.com              *
ECHO    *     Free for any use and modification       *
ECHO    *                                             *
ECHO    * – - – - – - – - – - – - – - – - – - – - – - *
ECHO.

ECHO    Instructions:
ECHO.
ECHO      1. Enter the drive letter of the drive with the data to backup (ie: “C”)
ECHO      2. Enter the path to the folder you wish to backup (ie: “Documents and Settings/Smith”)
ECHO      3. Enter the drive letter of your backup drive (ie: “E”)
ECHO      4. Enter the path to the specific backup location (ie: “backups/novemberBackup”)
ECHO      5. Verify your options and press “Y” to proceed or “N” to exit
ECHO.
ECHO  ____________________________________________________
ECHO.

:: Prompt for inputs
SET /P sourceLetter=1. Source drive letter:
SET /P sourcePath=2. Path to data you wish to backup:
SET /P destinationLetter=3. Destination drive letter:
SET /P destinationPath=4. Path to backup folder:

:: Set full source and destination
SET source=%sourceLetter%:/%sourcePath%
SET destination=%destinationLetter%:/%destinationPath%

ECHO.
ECHO  ____________________________________________________
ECHO.

:: Verify source and destination
ECHO      You are copying data from
ECHO.
ECHO      %source%
ECHO.
ECHO      to
ECHO.
ECHO      %destination%

ECHO.
ECHO  ____________________________________________________
ECHO.

SET /P continue= Proceed? (Y/N):
IF /I %continue%==N GOTO END

:: Set the logfile
SET logfile=%destination%/backup.log

:: Set the options. Note to remove the /XJD option on Windows XP
SET options=/MIR /XJD /LOG:%logfile% /R:0 /W:0 /TEE

:: Start the copy
ROBOCOPY %source% %destination% %options%

:END
ECHO.

pause

:: ROBOCOPY COMMAND OPTIONS

:: Do ROBOCOPY /? in a command prompt for details on other flags
:: /MIR = delete files from destination that have been deleted on source
:: /LOG = create a log file
:: /R:0 = don’t retry a file if it fails. Change number as you wish
:: /W:0 = don’t wait to retry a file if it fails. Change number as you wish
:: /TEE = output progress to console window. Turn this on if you want to see the file copy report at the end of your copy and progress during
:: /XJD = Windows Vista has some weird folder virtualization to prevent programs from accessing folders directly. Exclude Junction points to fix this.

Windows XP Users:

@ECHO off

ECHO.
ECHO    * – - – - – - – - – - – - – - – - – - – - – - *
ECHO    *                                             *
ECHO    *     Robocopy Backup Utility for Windows     *
ECHO    *     by Broken Remote via                    *
ECHO    *     brokenremote.wordpress.com              *
ECHO    *     Free for any use and modification       *
ECHO    *                                             *
ECHO    * – - – - – - – - – - – - – - – - – - – - – - *
ECHO.

ECHO    Instructions:
ECHO.
ECHO      1. Enter the drive letter of the drive with the data to backup (ie: “C”)
ECHO      2. Enter the path to the folder you wish to backup (ie: “Documents and Settings/Smith”)
ECHO      3. Enter the drive letter of your backup drive (ie: “E”)
ECHO      4. Enter the path to the specific backup location (ie: “backups/novemberBackup”)
ECHO      5. Verify your options and press “Y” to proceed or “N” to exit
ECHO.
ECHO  ____________________________________________________
ECHO.

:: Prompt for inputs
SET /P sourceLetter=1. Source drive letter:
SET /P sourcePath=2. Path to data you wish to backup:
SET /P destinationLetter=3. Destination drive letter:
SET /P destinationPath=4. Path to backup folder:

:: Set full source and destination
SET source=%sourceLetter%:/%sourcePath%
SET destination=%destinationLetter%:/%destinationPath%

ECHO.
ECHO  ____________________________________________________
ECHO.

:: Verify source and destination
ECHO      You are copying data from
ECHO.
ECHO      %source%
ECHO.
ECHO      to
ECHO.
ECHO      %destination%

ECHO.
ECHO  ____________________________________________________
ECHO.

SET /P continue= Proceed? (Y/N):
IF /I %continue%==N GOTO END

:: Set the logfile
SET logfile=%destination%/backup.log

:: Set the options. Note to remove the /XJD option on Windows XP
SET options=/MIR /LOG:%logfile% /R:0 /W:0 /TEE

:: Start the copy
ROBOCOPY %source% %destination% %options%

:END
ECHO.

pause

:: ROBOCOPY COMMAND OPTIONS

:: Do ROBOCOPY /? in a command prompt for details on other flags
:: /MIR = delete files from destination that have been deleted on source
:: /LOG = create a log file
:: /R:0 = don’t retry a file if it fails. Change number as you wish
:: /W:0 = don’t wait to retry a file if it fails. Change number as you wish
:: /TEE = output progress to console window. Turn this on if you want to see the file copy report at the end of your copy and progress during
:: /XJD = Windows Vista has some weird folder virtualization to prevent programs from accessing folders directly. Exclude Junction points to fix this.

September 29, 2008

Why Universities Should Not Use Windows Vista

Filed under: software, windows — Tags: , , , , — Broken Remote @ 9:52 pm

Many universities have begun to adopt laptop programs for all students. This basically means that all full-time student at the school either have the option or are required to purchase a specific laptop. This laptop will have all of the necessary academic software installed or made available to the student for their personal use.

Going to a school with a laptop program, I can tell you how great this works. Every student is endowed with a laptop computer. They can use it in class, take it to lab, take care of their homework or play games and surf the web. It’s an excellent asset to own when in college.

Now, there’s plenty more to discuss about laptop programs in general, but I’d like to make a few points against the use of Windows Vista (both in laptop programs and in general). Before I launch into these, I should note again that I am a student participating in a laptop program. The official supported operating system is Windows XP, but I’ve moved to Windows Vista and I can attest that it is difficult.

1. The “How Do I Use This” factor

Most students are now probably coming from Windows XP. This may begin to change as XP is not officially sanctioned for release on a new laptop (from major companies, anyways). So…you throw a student directly from XP into Vista. The tech-savvy could handle it, but it’s a big jump for most people. Ok, so you can argue that it’s a new OS anyways, what does it have to do with a university? Well maybe it doesn’t, but regardless, Windows decided to change nearly everything about the operating system look and feel. How about we try to solve the security and software problems, then slowly move users into a new look and feel…or offer a “classic” version that does more than take away the special effects. We know where things are in XP, why move them in Vista?

2. Specialty Software

Here’s the big point for a lot of schools. There’s a lot of specialty academic software out there. You’re talking CAD tools, mathematics programs, circuit simulators, etc. While things are getting better for academic software and Vista, a lot of programs are hardly ready. I’m in a course now where Windows Vista could not properly install a debugging tool because it renamed a .dll file in a system folder. I got it working because I found a new version of the software online that happened to be free (with a few acceptable limitations). But how many other applications won’t have that available? A school may own licenses for software it can’t even use. Big problem and big waste of money.

3. Resource Hog

One of the more minor issues, but still an issue. I have a capable laptop. It’s just over 3 years old and came pre-installed with 1GB of RAM and a 256 MB dedicated video card. That’s pretty good, especially to run XP. Problem is, Windows Vista can barely make it on that. I’m using 800 MB of memory just writing this with Firefox and Thunderbird running. I had to upgrade my RAM just so I could reasonably do things. Oh sure I could turn off the graphic effects, but that’s not a solution. I’ll also admit that new laptops are doing pretty well these days for not too much cash, but your operating system shouldn’t need to use that many resources.

4. Driver Issues

Finally, driver issues. I can’t tell you how many hours I’ve spent installing crazy beta drivers for my nVidia card after installing Vista. Blame nVidia? Partially. Blame Microsoft? Mostly. If they’re going to release an operating system, they had better know it works with both old and new video cards. There’s also Creative, known for sound cards, who was slow to get on the ball with Vista. I’m sure there are other manufacturers out there who have poor or no Vista drivers ready either.

Now granted, if you read this post two or even just one year ago, it would be a lot longer. I admit that Vista is improving and support for all these things is getting better, but it’s not ready yet. Oh, let’s not forget that Windows 7 is in development, due for release in 2009 or 2010. We can only hope this is a better operating system – what Vista should have been.

September 27, 2008

A Great Batch Script

Filed under: software, windows — Tags: , , — Broken Remote @ 12:29 pm

Just drop this code into a .bat file, then run it any time you need to restart the explorer.exe process. Tested to work on Windows Vista.

@echo off
taskkill /f /IM explorer.exe
explorer.exe

Theme: Silver is the New Black. Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.