Created
May 18, 2011 07:33
-
-
Save dhinus/978148 to your computer and use it in GitHub Desktop.
Export Apple Mail RSS feeds to opml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Script to export Mail RSS subscriptions to an OPML file. | |
# Written by VividVisions.com | |
# http://www.vividvisions.com/2008/02/22/rss-subscriptions-aus-apple-mail-exportieren/ | |
# | |
# Modified by Francesco Negri | |
# https://github.com/dhinus | |
IFS=$'\n' | |
path=`echo ~/Library/Mail/RSS` | |
filename="Mail Export.opml" | |
if [ ! -d $path ] | |
then | |
echo "Error: ~/Library/Mail/RSS not found." | |
exit 1 | |
fi | |
echo '<?xml version="1.0" encoding="utf-8"?> | |
<opml version="1.0"> | |
<head> | |
<title>Apple Mail Subscriptions</title> | |
<dateCreated>'`date +%Y-%m-%d' '%H:%M:%S' '%z`'</dateCreated> | |
</head> | |
<body> | |
<outline text="Apple Mail Import">' >$filename | |
for file in $(find "$path" -name Info.plist) | |
do | |
name=${file%.rss*} | |
name=${name##*/} | |
name=${name//\"/\'} | |
name=${name/&/&} | |
url=`grep '<string>http' "$file" | grep -o 'http[^<]*'` | |
echo "<outline type=\"rss\" xmlUrl=\"$url\" text=\"$name\" description=\"$name\" />" >> $filename | |
done | |
echo '</outline> | |
</body> | |
</opml>' >> $filename | |
echo "Done" | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment