Ubuntu mp3 sync script help needed
June 23, 2016 5:23 PM Subscribe
I am looking at writing a script for my Ubuntu system that synchronizes the latest (as in, last added) N (say, 10 or 20) files from one of my home folders with one of my Dropbox folders. Rsync seems to offer all but one needed feature.
Basically I want to be able to listen to my newest favorite tunes wherever I go. And that music is always an mp3 file or mp4 file in the source folder.
Rsync seems to handle everything except the "limit it to 10-20 files" part. How can I do that? Thanks!
Basically I want to be able to listen to my newest favorite tunes wherever I go. And that music is always an mp3 file or mp4 file in the source folder.
Rsync seems to handle everything except the "limit it to 10-20 files" part. How can I do that? Thanks!
Best answer: Something like:
posted by hoyland at 5:43 PM on June 23, 2016 [1 favorite]
ls -t | head -n 10 | rsync --from0 --files-from - ./ destshould do it. Here is the man page for rsync.
posted by hoyland at 5:43 PM on June 23, 2016 [1 favorite]
Response by poster: > Are you using ZSH?
Nope. Maybe I should though! :-) That modifier looks super convenient.
> Something like...
Thank you! I think that got me far enough. I ended up with this example version working:
posted by circular at 6:27 PM on June 23, 2016
Nope. Maybe I should though! :-) That modifier looks super convenient.
> Something like...
Thank you! I think that got me far enough. I ended up with this example version working:
ls -t1 ./*.mp3 | head -n 15 | rsync --files-from=- ./ ~/tmp/soundtmp/I'll customize it from there!
posted by circular at 6:27 PM on June 23, 2016
This thread is closed to new comments.
posted by CrystalDave at 5:42 PM on June 23, 2016 [1 favorite]