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?
Re: Maintain Parody Between Folders?
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.
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
Quote:
rsync [OPTION...] SRC... [DEST]
and
Quote:
--delete delete extraneous files from dest dirs
So would the mp3 player be the SRC and the backup as the DEST?
Re: Maintain Parody Between Folders?
Quote:
Originally Posted by
mamamia88
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.
Re: Maintain Parody Between Folders?
Quote:
Originally Posted by
ajgreeny
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
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
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.
Re: Maintain Parody Between Folders?
I also get a bit bamboozled by the rsync syntax and flags so I regularly use Grsync
Re: Maintain Parody Between Folders?
Quote:
Originally Posted by
tea for one
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.