More on UNIX-heavy DOS scripts
If you were to ask me why I spend so much time using UNIX software on the Windows platform, I'd probably say something like "because I don't feel like fucking around with X for the next five years before my mouse starts to work OK".
Windows in my opinion provides a better GUI experience but for any kind of, you know, real work, I prefer something with a command line.
Needless to say, this extends to synchronizing music files with my iRiver. Now you iPod owners, I'm told, have a button you click and your music collections get merged to the device.
Well lah-dee-dah. There are two things I like about iTunes and the rest of it can go straight to hell for all I care. (For the curious: one, it can rip a CD track to an MP3 fairly quickly and two, Party Shuffle is really quite neat.) Here's how I do it as of this afternoon.
Step one: make a Maildir-style directory for your podcasts. Call it "Podcasts":
C:\> mkdir "Podcasts\cur" C:\> mkdir "Podcasts\new" C:\> mkdir "Podcasts\tmp"This is going to mean putting your new podcasts in "Podcasts\new" and keeping the existing podcasts currently on your iRiver in "Podcasts\cur". For a long time I used robocopy to push files back and forth, but using an obscure Microsoft tool like robocopy when I instead could be using the awesome power of rsync just never sat right with me.
Step two: write a bitchin' batch script that calls all sorts of crazy shit. The basic flow of the script is as follows:
a) If a file exists only on the iRiver, rsync it to "Podcasts\cur".
b) If a file exists only in "Podcasts\cur" and not on the iRiver, delete it from "Podcasts\cur".
c) If a file exists in "Podcasts\new", rsync it to the iRiver.
d) Once all files have been rsynced to the iRiver from "Podcasts\new", move those files to "Podcasts\cur".
Preliminary tests indicate that this method seems to work OK. The script looks like this:
@echo on set UNIXPODCASTDIR=/cygdrive/c/Documents and Settings/toby/Desktop/bashpodder/Podcasts set DOSPODCASTDIR=C:\Documents and Settings\toby\Desktop\bashpodder\Podcasts set IRIVERDIR=/cygdrive/f/Podcasts rsync --verbose --archive --size-only --delete "%IRIVERDIR%/" "%UNIXPODCASTDIR%/cur/" rsync --verbose --archive --size-only --partial --progress --stats "%UNIXPODCASTDIR%/new/" "%IRIVERDIR%/" pause move /Y "%DOSPODCASTDIR%\new\*.*" "%DOSPODCASTDIR%\cur\" pause
No comments:
Post a Comment