Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Click here to return to the 'Easy conversion of multiple Safari .webloc to PC .url files' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Easy conversion of multiple Safari .webloc to PC .url files
Authored by: fsb on Sep 06, '05 07:55:16PM
Here's a modified version that makes an .html file instead, which redirects to the URL when opened. This conforms to the "HTML 4.01 Transitional" standard and should work as a web shortcut for any browser on any platform.

# Easy conversion of multiple Safari .webloc to universal .html 
# redirection files which should work with any browser.

if [ $# -lt 1 ]; then
echo << EOF "
Usage: `basename $0` "file1.webloc" "file2.webloc" ...

       Converts Mac style web location files into
       HTML files which redirect to that web location.
       Can convert multiple files listed on command line.
       Filenames with spaces must be quoted.
       ex: convert all .webloc files in given directory 
           to .html files
           `basename $0` *

for i in "$@"
webloc_name=(`strings "$i/rsrc" | grep http | sed 's/^.//' | head -1`)
html_name="`echo "$i" | sed 's/.webloc/.html/g'`"
url="`strings "$i"/rsrc | grep http | sed 's/^.//' | head -1`"

cat << EOF >$html_name
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en" dir="ltr">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<TITLE>Transferring to $url...</TITLE>
Transferring to <A 
Click the link if nothing seems to be happening.

echo "Conversion completed and saved as:"
echo "       $html_name"
echo ""

[ Reply to This | # ]