Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Syncing UCD "My Documents" with a USB Key.

Options
  • 24-09-2009 4:36pm
    #1
    Registered Users Posts: 13,010 ✭✭✭✭


    Hi,

    This is something I've been doing at UCD for a while now: syncing all my "Personal" files (on the UCD system) with a USB Key or other storage device. I think it's stable enough to tell other folks about it now - I think! Now that it's set up, I plug the USB key in, double-click on a Desktop shortcut, and it automatically synchronises the files on the key with the UCD PC's "My Documents" folder in seconds. That way, I always assured that I'm taking the latest files home with me.

    Note: I don't know if UCD IT Services approves of this, since it involves creating a "batch script" and running a 3rd-party (open source) executable file. If they say Don't Do It, then ... Don't Do It. The method I use has some slightly technical bits in it: I assume you can do basic Windows stuff like extract files from a ZIP file, and use Notepad to create text files and save them to specified locations. So, if all of the following just has you going "huh?", I can't help you, m'kay? :cool:

    I use a little program called Unison to synchronise files between two directories, such as a USB key and a local drive. By "synchronise" I mean that it keeps both sides up-to-date with the latest files, so that you can make changes on either side and they are replicated over correctly. This includes deletions of files. *

    Assuming you want to sync "My Documents" from a UCD PC (H:\Personal) as I did, this is what to do:
    • Open drive H: (in My Computer) and create a directory named "Unison". All Unison program files will go in here, H:\Unison. Note that this is not under "My Documents", for good reason.
    • Open the USB Key (or whatever) and create a directory for your files, (if you don't have one already). In my case this is E:\Personal, so I'll use that in this example. Copy all the files you want to keep from "My Documents" to here in advance, which speeds things up later (if you aren't doing this already).
    • Download Unison for Windows from this site, . The stable version is 2.27.157. Extract the "text" version to H:\Unison. (The GTK (graphical) version won't work on UCD PCs, but you don't need it.) I renamed the file to H:\Unison\Unison.exe for simplicity's sake - the following assumes that you do too.
    • Open Notepad and paste the following in:
      root = E:\Personal
      root = H:\Personal
      times = true
      pretendwin = true
      
      Note: If you are using different directories to my examples, change the first two lines to match what you are using! This is the Unison Preferences file for this sync operation: save as H:\Unison\Personal.prf.
    • Open Notepad again and paste the following in:
      h:
       
      cd H:\Unison
      
      SET UNISON=H:\Unison
      SET UNISONLOCALHOSTNAME=UCD
      
      %UNISON%\unison -batch -fastcheck true Personal
      
      if errorlevel 1 %UNISON%\unison Personal
      
      pause
      
      Save as e.g. H:\Unison\sync.cmd . This is the "batch script" that you will run to perform the sync operation. You can rename or modify it to suit your preferences later if needed. You can create a Desktop shortcut to this if you like, so it's easy to get to.
    Double-click on sync.cmd (the "batch script") to run it. The first time you run it, Unison will see that there is no index saved, so it will run in "first time" mode. This will copy all files on both sides to both sides (network disk and USB key), to make sure everything is safely saved. It won't delete anything at this time, but it might take a long-ish time to copy everything, which is why I recommended copying the files manually in advance.

    The second and subsequent times you run it, it will use the index to detect changes to either side, and replicate those changes to both sides. This includes file deletions, so if you delete a file on one side, it will be deleted on the other side when you sync! Be aware of this - it is a "true mirror" system that keeps both sides identical, for better or for worse.

    The batch script runs the program once in "batch fast check" mode, which is usually fine. If it detects something odd, such as conflicting changes to a document, it runs again in "normal" (slow) mode then asks you what to do. If that happens, you should check the flagged files manually, in case you risk losing some changes. It's not smart enough to merge changes from e.g. 2 Word documents! The trick is: don't do that, and sync often, so that there's no confusion.

    Some techy details for those interested:
    • the extra options in the Preferences file (lines 3 & 4) are specific to Windows systems, to speed things up.
    • the two SET lines in the batch script set environment variables to do two things: tell Unison to use the directory you want it to (H:\Unison) and to create a "fake computer name". Normally, the index is keyed to a specific PC, but the second line overrides that, so you can use this script on any PC at UCD and it remembers the file states. (Otherwise, it thinks every time is the first time.)
    • There is a manual on the program author's site, which has a lot more detail, here.
    Again, if the above looks like too much for you, then it probably is! Don't sweat it. :P

    Death has this much to be said for it:
    You don’t have to get out of bed for it.
    Wherever you happen to be
    They bring it to you—free.

    — Kingsley Amis



Comments

  • Registered Users Posts: 8,004 ✭✭✭ironclaw


    Great post.

    I'm trying to devise a way to sync with BlackBoard without BackPack. And H Drive is also out for the moment as Novell don't seem to do a Client for Apple.


  • Registered Users Posts: 13,010 ✭✭✭✭bnt


    NB: It was also possible, on Windows, to mount your H: drive on your PC at home, and transfer files back and forth over the Internet. It requires a little piece of software called Novell Netdrive, which you get from UCD and which I wrote about before, here. Note that I haven't tried this recently, and don't know whether it still works or not.

    I thought it was WebDAV compliant, which would mean that you could get it working on a Mac too, but I couldn't get it to connect on a Linux system, so I don't hold out much hope for a Mac either. You could try it, using the parameters listed at the UCD page above.

    The new system, Connect Files, has no connection to your H: drive, but it IS WebDAV-compliant, and UCD provides Mac instructions on that web page. I've also successfully connected to it under Linux. If I can figure out how to mount it as a drive letter at UCD, rather than a "web folder". I'll be happier using that than the H: drive.

    Death has this much to be said for it:
    You don’t have to get out of bed for it.
    Wherever you happen to be
    They bring it to you—free.

    — Kingsley Amis



Advertisement