Hi folks! This is mainly for my own record but maybe it can help others.
I made some links in Windows to web pages but all I got was these .URL files.
Code:
[InternetShortcut]
URL=http://www.w3.org/
IDList=
HotKey=0
IconFile=C:\Users\User\AppData\Roaming\Mozilla\Firefox\Profiles\8rn9f680.User\shortcutCache\gt5hKbqP7+v5RX5n3nCzwW==.ico
IconIndex=0
They contain a URL= line but the Linux equivalent is slightly different.
Code:
[Desktop Entry]
Type=Link
URL=http://www.w3.org/show/217230
These three lines a sufficent for a working web link. Here's my bash script that will convert all URL files to .desktop files:
Code:
#!/bin/bash
#case-insensitive
shopt -s nocaseglob
#give folder as argument or execute in current directory
[ -n "${1}" -a -d "${1}" ] && cd "${1}"
for file in *.url
do
URLLINE=$(grep -Ei url= "$file")
FILENAME=`echo $(basename "$file") | cut -d'.' -f1`
echo -ne "[Desktop Entry]\nType=Link\n$URLLINE" > "$FILENAME.desktop"
done
As always save as file and make executable.
#Licence: CC BY-SA
#Sources: ubuntuuser.de, tldp.org, linuxquestions.org