Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: Maintain Parity Between Folders?

  1. #1
    Join Date
    Dec 2008
    Location
    Indiana, United States
    Beans
    764

    Maintain Parity Between Folders?

    I mostly listen to my music on a portable mp3 player around the house. Well the the thing is so tiny I know I'll manage to lose it someday so I would like to make sure my music is all backed up just in case. I know I can redownload it again from amazon but that would be a pia if i could just copy it back from a backup folder. My music is all stored in a single folder in .mp3 files and tagged with proper metadata. I would like to have at least 2 backups. I usually just dump an entire album onto the mp3 player and when a song comes up that i don't like i delete it directly on the player. My question is, is there any easy way to automatically delete the files from the backup folder that no longer exist on the mp3 player? Something like diff but that appends an rm it?
    Whoever came up with the phrase "There is no such thing as a stupid question" obviously never had the internet.

  2. #2
    Join Date
    Dec 2007
    Beans
    12,521

    Re: Maintain Parody Between Folders?

    Parity?

  3. #3
    Join Date
    Nov 2007
    Location
    London, England
    Beans
    7,701

    Re: Maintain Parody Between Folders?

    I would use rsync for that kind of job. Something like
    Code:
    rsync --delete /media/myname/musicplayer /home/myname/music/myplayer
    but that is from memory, and using made-up names. Still, it should give you the general idea.

  4. #4
    Join Date
    Dec 2008
    Location
    Indiana, United States
    Beans
    764

    Re: Maintain Parody Between Folders?

    hmm i need to look into rsyn. Sounds promising. Edit the usage for rsync in the manual says
    For usage
    rsync [OPTION...] SRC... [DEST]
    and
    --delete delete extraneous files from dest dirs
    So would the mp3 player be the SRC and the backup as the DEST?
    Last edited by mamamia88; September 12th, 2013 at 09:27 PM.
    Whoever came up with the phrase "There is no such thing as a stupid question" obviously never had the internet.

  5. #5
    Join Date
    Jul 2005
    Location
    I think I'm here! Maybe?
    Beans
    Hidden!
    Distro
    Xubuntu 22.04 Jammy Jellyfish

    Re: Maintain Parody Between Folders?

    Quote Originally Posted by mamamia88 View Post
    hmm i need to look into rsyn. Sounds promising. Edit the usage for rsync in the manual says
    For usage
    and So would the mp3 player be the SRC and the backup as the DEST?
    Yes, that's correct.

    I've never used it, but I think unison could also do the same job, but if rsync works for you, stick with it.

  6. #6
    Join Date
    Dec 2008
    Location
    Indiana, United States
    Beans
    764

    Re: Maintain Parody Between Folders?

    Quote Originally Posted by ajgreeny View Post
    Yes, that's correct.

    I've never used it, but I think unison could also do the same job, but if rsync works for you, stick with it.
    Well that doesn't work. I created two folders called A and B. I then created text files 1 2 3 in A and Copied them to B. I then deleted 3 in A. I ran the command rsync --delete /home/user/A /home/user/B and it told me it wouldn't work without the --dirs option. So i through that in the command and all it seemed to do was create an empty folder called A in B. Any ideas? Unity gui with option to resolve differences for first root seems to work. Wonder what the similar command would be
    Last edited by mamamia88; September 12th, 2013 at 09:59 PM.
    Whoever came up with the phrase "There is no such thing as a stupid question" obviously never had the internet.

  7. #7
    Join Date
    Dec 2008
    Location
    Indiana, United States
    Beans
    764

    Re: Maintain Parody Between Folders?

    AHHHH this is driving me crazy. rsync -r --delete /path/to/A /path/to/B just copies files in A minus files in B to a folder in B called A. And rsync --dirs -delete /path/to/A /path/to/B just creates and empty folder called A in B. And it won't let me use --delete without running either dirs or -r
    Whoever came up with the phrase "There is no such thing as a stupid question" obviously never had the internet.

  8. #8
    Join Date
    Nov 2007
    Location
    London, England
    Beans
    7,701

    Re: Maintain Parody Between Folders?

    rsync -r --delete /path/to/A /path/to/B
    will duplicate folder A into folder B so now you have a copy of folder A in folder B.

    If you want to just duplicate the contents of folder A into folder B, put a slash after the A like this:
    rsync -r --delete /path/to/A/ /path/to/B

    Adding a -v option may help understand what it's doing.

  9. #9
    Join Date
    May 2008
    Beans
    3,980
    Distro
    Ubuntu 22.04 Jammy Jellyfish

    Re: Maintain Parody Between Folders?

    I also get a bit bamboozled by the rsync syntax and flags so I regularly use Grsync

  10. #10
    Join Date
    Jul 2005
    Location
    I think I'm here! Maybe?
    Beans
    Hidden!
    Distro
    Xubuntu 22.04 Jammy Jellyfish

    Re: Maintain Parody Between Folders?

    Quote Originally Posted by tea for one View Post
    I also get a bit bamboozled by the rsync syntax and flags so I regularly use Grsync
    Same here.

    If you use grsync and browse to the folders you are wanting to sync, it adds the trailing / to folders automatically, avoiding the problem you had.

Page 1 of 2 12 LastLast

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
  •