rSync Error -Solved(mostly)

Discussion in 'Mac Basics and Help' started by i.shaun, Jun 9, 2009.

  1. i.shaun macrumors 6502a


    May 1, 2008
    Haha, I guess I do need help. . Figures it wouldn't work for me. .

    I did this command:
    rsync --delete -avrzogtp /Users/shaun/Files/ /Volumes/THE_500/_Files/
    Problems that occur:

    It doesn't copy custom icons attached to folders or files. Instead everything in the destination has generic icons, and a strange file called "Icon" appears in any folder that contained custom icons.

    This "Icon" file says it's a document, opens in textedit with nothing in it, Zero kb on disk, and it doesn't have an extention. It is most likely the leftover of the custom icons that it didn't know what to do with.

    It also screwed up a folder full of custom icon files that I store for the purposes of adding them to folders, apps, or files for customization. PNG Images remain, but have generic icons, ICNS files remain, but have generic icons (so I can't "Get Info"), and RSRC files are either Documents, or Unix Executables, which makes them corrupted and unusable as icons.

    Any Idea why the files didn't copy properly?
  2. i.shaun thread starter macrumors 6502a


    May 1, 2008
    Bump. I'm still looking into this, I've tried running it again with some different commands to preserve files but those failed too.

    Strange. . It worked perfectly for me on all the tests, unfortunately all the tests only did images, folders, and an html document. . nothing handling custom icons files, or folders/files with custom icons attached to them.


    I remember a problem when attempting to copy icons using terminal, or applescripts, or anything. I thought maybe It was me but it seemed to be saying it didn't have access to the file. rSync probably doesn't have whatever access is required to copy custom icons either, which is why it has trouble with those files.

    Being the resourceful person I am, I'm going to use automator to do the same thing using This Automator Action

    Now I just have to figure out how to get it to run properly. Somehow when I saved it as an application, it didn't run the workflow to copy my files, instead it copied just itself to the destination.
  3. angelwatt Moderator emeritus


    Aug 16, 2005
    The -a argument equals the arguments -rlptgoD so you have redundancies. Your args should just be -avz, which is generally what I use. I don't know if having duplicate args causes problems though.

    What are the file system types that you're using for source and destination e.g., HFS, FAT, etc.?
  4. i.shaun thread starter macrumors 6502a


    May 1, 2008
    Both drives are HFS+J (OS X Extended (Journaled)

    So I'm running too many options for simple file copying? I know I need the --delete option so that duplicates are deleted in the event that I re-name a file (I don't want the file with the original name, and a duplicate with the new name);.
  5. angelwatt Moderator emeritus


    Aug 16, 2005
    From the rsync man page.
    -a, --archive               archive mode; equals -rlptgoD (no -H,-A,-X)
    You can look through the other arguments as well as one may be of help here. I don't have the time at the moment though.
  6. i.shaun thread starter macrumors 6502a


    May 1, 2008
    Alrighty, I was basically throwing the same commands at it again with the "-a" function. However doing so does not appear to cause a problem.

    I tried your much more simplified approach, and It still cannot handle custom icons or aliases. I'm starting to doubt Terminal's effectiveness in this matter. For whatever reason, it seems to be unable to handle or process these types of files.

    edit: I also tried other arguments from the man page, but didn't find any to be of use. I tried preserving special attributes, special files, I tried "-W" which copied the whole file 'as is', none seem to work. The rSync command works well for documents, photos, and other files to keep in sync, but not custom icons files (rsrc format), Aliases, or files with custom icons swapped to them (it will copy them, but they will have generic icons at the destination).
  7. angelwatt Moderator emeritus


    Aug 16, 2005
  8. i.shaun thread starter macrumors 6502a


    May 1, 2008
    Thanks for the info, angelwatt. I'll look into it further and won't post on this thread again until I find the solution!

    I have 2 folders set up again "One" & "Two" (simple). I'll test my stuff out on them with Icns, Rsrc, Aliases, and even a file with a custom icon swapped to it, along with a text document and image file just to make sure I don't somehow fix the problem and create another one with normal files.

    Hopefully I can find out, it would be nice to succeed in a complicated project for once lol

    I may even figure out a way to copy & paste icons to files automatically this way (if possible via terminal). If I can then 2 applescript dropplets could make things easier one day.
  9. i.shaun thread starter macrumors 6502a


    May 1, 2008
    Success! (mostly)

    With the help of angelwatt I finally got rSync to sync some important files to an External HDD automatically.

    This Method is not perfect, there is a slight issue I was unable to resolve, but it does work. Details at the bottom.

    Step 1

    Open, and type in (without quotes): "rsync --version"

    If the version displayed is not 3.0.5 or greater, you should download the latest release

    I selected http download, then in the list I scrolled down to

    Double click the file to open it. If you are unable to open it, you probably need Stuffit Expander

    Once opened, and unpacked, you will see a folder with lots of files inside.

    To Install

    Find the "INSTALL" Document, and notice that it says:
    To build and install rsync:
      $ ./configure
      $ make
      # make install
    In Terminal, type in "cd", space, then drag the rsync folder you unpacked from the desktop into terminal and hit ENTER.

    Now Terminal will be working from that folder, you should notice the folder's path before the $ sign where you type:

    ~/Desktop/rsync-3.0.6 shaun$ 
    Now that you're working from the folder, do exactly what the file said:
    Type in. .
    Hit enter, and it will begin doing stuff, once it finishes, type in:
    It should do a bit more stuff automatically, and then finally:

    sudo make install
    sudo will give it the permissions it requires in order to finish.

    Open Finder, and go to the hard drive. There is a hidden folder here called "usr". To access it, click "Go" in the finder menu, and select "go to folder". Then type in /usr and press OK.

    You will now see inside this hidden folder. Here lies the problem I encountered:

    rsync is automatically installed in OS X in the:
    /usr/bin/ folder.
    The Updated version I installed with the steps above went into:

    No problem, simply access the hidden usr folder, navigate to /usr/local/bin/rsync and drag the file into Terminal.

    you should see something like:
    shaun$ /usr/local/bin/rsync

    You just have to type out the path to the new rsync rather than just typing "rsync".


    To automate the process for fast backups at the click of a button, or on each login, do the following:

    Open Script Editor
    /Applications/Apple Script/Script

    Paste the following code:

    on run
    	tell application "Finder"
    		do shell script "/usr/local/bin/rsync --delete -avzX  /path/to/main/folder/  /path/to/destination/folder/ "
    	end tell
    end run
    Everything in quotes is what the script enters as a command

    /usr/local/bin/rsync is the command.
    --delete -avzX are arguments They tell the "rsync" command what to do. A full list of arguments can be found Here

    "a" "v" "z" "X" are case-sensitive, and are all separate, but can be placed together after the dash "-".
    --delete is a single argument that must come first before the others.

    -a = archive (a bunch of arguments in one)
    -v = verbose (verbose argument determines how much information goes to the screen while the command is running. With rsync you'll see each file that is getting updated. Without verbose you would just be watching a blinking cursor while it runs with no idea what it's doing)
    -z = compress (compresses files during transfer)
    -X = preserve Extended attributes (custom icons, aliases, etc..)

    --delete = Deletes extra files in the destination (anything at the destination folder that is NOT in the starting folder is deleted to maintain a perfect sync
    Do not use the --delete command if you intend to work from the destination folder aswell, or you could create a file, and have it deleted because it does not exist in the starting folder

    save the script as an "application" in the "save as..." menu. Drag it to the dock for quick access, or enter system preferences, accounts, 'startup items'. Add a new item to run on startup, find the application you just saved, and add it to the list.

    On each login, the app will launch, which will simply run the command to sync the folders.

    And that's about it. I set mine up to sync a "Files" folder where I keep all documents/photos, and also a separate one to sync my iTunes music folder to the external HDD. It copied documents, pictures, special .rsrc & .icns icon files, and also preserves the custom icons attached to folders and files -- that's what the "-X" command was for, and that's why I needed rsync 3.0.6 installed because 2.0 did not recognize the "-X" argument.

    Credit goes to angelwatt

    Here is another message relating to the fact that the new rsync installs in another location to the normal one:
    from angelwatt
    I went through the update and saw it does install to a separate location. It doesn't want to overwrite the exiting one. You could move the new one to the old location an overwrite it, but don't have to.

    In addition to typing the full path, you can also create an alias, which lets you setup a short command to call the full path. It just involves adding a line to a file (that may or may not currently exist).

    1. Open Terminal
    2. Type: pico ~/.profile
    3. It opens a file to edit and enter this line,
    4. alias rsync2="/usr/local/bin/rsync"
    5. Then hold ctrl and hit X to get out. It'll ask to save the file, hit Y, then enter.
    6. Next time you start up Terminal you can use the rsync2 command to call the new version.
    That's just an alternative if you're wanting to do it. Since you'll be using the command in a script it won't really make a difference.

    Introduction to UNIX

    Commonly used UNIX Commands

Share This Page