Sync PDF Folder to Kindle
A quick hack to automate syncing my "to_read" PDFs folder on my desktop with a folder on my Kindle DX. This hack comes in two parts, both of which will require editing to make it fit for you. If you make updates to this hack, let me know and I'll incorporate them here. Also, I will update this hack over time so follow me on Twitter to find out about updates. If you encounter any errors and would like some help, feel free to email me.
Part 1 - Bash script
This script is run whenever launchd detects that a new Volume has been mounted. It checks to see if the Kindle volume is present and if so it:
- Syncs a directory from your computer to the Kindle's documents folder.
growlnotifyto let you know when this is done.
- Ejects the Kindle volume so you do not have to do it manually.
if [ -x /Volumes/Kindle ]
rsync -arv --size-only --delete ~/Desktop/to_read/ /Volumes/Kindle/documents/to_read/
if [ -x /usr/local/bin/growlnotify ]
/usr/local/bin/growlnotify -m "Kindle Sync Complete"
echo "Kindle Sync Complete"
diskutil eject /Volumes/Kindle
Making it work:
Make sure that the paths of your desktop directory (in my case
~/Desktop/to_read/) and Kindle directory match your directory choices.
Copy the file to some permanent place and make sure that it is
set to be executable (i.e.
chmod a+x syncToReadToKindle).
Part 2 - Launchd Plist
File : com.nirmalpatel.KindleToRead.plist
This plist tells launchd to run the bash script from Part 1 any time a new volume is mounted. The bash script takes care of checking if the Kindle volume is mounted.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
Making it work:
Open it and edit the part that says
/Users/nirmal/bin/syncToReadKindleto point to the download location of the script from Part 1.
Move this file over to
~/Library/LaunchAgentson your machine.