Results 1 to 5 of 5

Thread: RSYNC Script/One liner

  1. #1
    Join Date
    Sep 2007
    Beans
    85

    Post RSYNC Script/One liner

    Hi guys, hoping someone can help.

    The current command I'm using is

    Code:
    screen rsync -avh --exclude-from=/home/root/rsync-exclude --progress /media/MUSIC/ /media/MyBook/Music/rsync/ | egrep -E '/$' | sed 's/\/$//g'
    which will list only directories that are due to transfer and output them on a detachable screen.

    What i'd like to do is get the output of the rsync to display normally (eg show the percentage done on the file realtime) but append the directories created back to the rsync-exclude file. I think there'll be a 'tee' in there somewhere but im not sure on how to incorporate this. something like?

    Code:
    screen rsync -avh --exclude-from=/home/root/rsync-exclude --progress /media/MUSIC/ /media/MyBook/Music/rsync/ |  tee "'egrep -E '/$' | sed 's/\/$//g' | cat >> rsync-exclude" | ???
    so that would produce

    screen rsync-exclude
    foo/ foo
    foo/foo-bar.mp3 bar
    bar/
    bar/bar-foo.mp3 96% 130kB/s 0:00:00


    as always, thanks in advance
    Last edited by kg87; March 5th, 2013 at 07:50 PM.

  2. #2
    Join Date
    Sep 2007
    Beans
    85

    Re: RSYNC Script/One liner

    bump - anyone?!

  3. #3
    Join Date
    Sep 2007
    Beans
    85

    Re: RSYNC Script/One liner

    found my own solution

    Code:
     rsync -avh --exclude-from=/rsync-exclude --progress /dira/MUSIC/ /dirb/Music/ |  tee >( egrep -E '/$' | sed 's/\/$//g' | cat >> rsync-exclude )
    All i was missing was the ">" and the brackets

  4. #4
    Join Date
    Feb 2013
    Beans
    Hidden!

    Re: RSYNC Script/One liner

    Quote Originally Posted by kg87 View Post
    Code:
    rsync -avh --exclude-from=/rsync-exclude --progress /dira/MUSIC/ /dirb/Music/ |  tee >( egrep -E '/$' | sed 's/\/$//g' | cat >> rsync-exclude )
    It probably could be further simplified like this
    Code:
    rsync -avh --exclude-from=/rsync-exclude --progress /dira/MUSIC/ /dirb/Music/ | tee >(sed -n 's:/$::p' >>rsync-exclude)
    or even like this
    Code:
    rsync -avh --exclude-from=/rsync-exclude --progress /dira/MUSIC/ /dirb/Music/ | sed 's:/$::w/dev/stderr' 2>>rsync-exclude)

  5. #5
    Join Date
    Sep 2007
    Beans
    85

    Re: RSYNC Script/One liner

    Awesome, thanks for that ... the /dev/stderr looks interesting.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •