You are not logged in.
Hello,
Is it possible to make rsync sync only the newest files up to a total limit of 10gb?
My situation:
I have a music collection of 50gb and an mp3player that has 10gb of storage. What i want to do is copying only the 10gb of my collection to the mp3player that were accessed last.
I was going to write some script using find and rsync but i am sure im not the first to encounter this problem.
crabman
Offline
I personally would use a while loop based on du -hs of mp3 player being less than 10Gb, copy files using cp, from a list determined using something else(not my area), probably the find command with -atime.
You really wouldn't have to use rsync and I see no point in doing so.
Also I would have thought this thread would be better in newbies corner.
If you read the forum guidelines/rules the arch community prefers if you do things for yourself, ie we are not really going to write all your scripts for you.
Last edited by llawwehttam (2011-07-27 17:17:23)
Offline
I want to keep a copy of the newest 10gb of 40gb of files in sync, so copy, delet and update these files. I thought rsync might be easier for that task.
I am willing/able to write a script like that myself, but since this is such a generic task i cannot imaginge there is no solution out there already. Probably something better than what i could come up within an evening of bash-coding.
crabman
Offline
since this is such a generic task
Generic task? I really can't imagine that this is a very common use case...
ᶘ ᵒᴥᵒᶅ
Offline
Probably something better than what i could come up within an evening of bash-coding.
An evening of bash-coding? Oh come on ;P
Offline
My solution has always been has always been to use the built-in "format" command in my portable player's menu to wipe it, then just copy over the new stuff I've got from the folder I rip / download it to. Not as quick-and-easy as a single script, sure, but hey: I've bricked a player in the past by mucking around in the wrong way. It's important to note that your 10-gig player probably only has 8.x gigs available after formatting, so there's a complication for ya. You'd need to write up something specifically instructed not to go within a certain range limit (lest you end up with a fraction of an album just sitting there) and which won't screw with the device's firmware, as I'm guessing rsync isn't likely to find that in your music library.
Offline
rsync + find /path/to/music -atime sounds like *exactly* the solution you're after, actually. you'll just need one more bit of abstraction to limit transfer to ~8gb.
rsync is efficient at this kind of task, find knows how to find your music well, just need to sort by -atime and size, limit it to ~8gb and go. it will take a bit of learning, but i don't see any clearner or faster solution. you might be able to use the output from find to archive the music into a single folder and then extract that under your mp3 player, but i think rsync would still be better for the overall goal.
Offline