A few things todo before the move is to convert some Mac-files into “normal” files. That is,
They’re great. Really, but also a PITA to convert. A
.textClipping is not a text file. The text/content is embedded in the resource.
If you don’t know what it is… It’s basically - you mark/select some text and drag the selction to your Desktop, or into a folder. The file (
*.textClipping) can be used like you want it, like drag into a document and the content is pasted into it, etc.
There’s a tool to work with. It’s an old gem included in Xcode or the CLI-tools called
DeRez - which is great and can extract the content, be used for scripting etc. However… A
.textClipping can store both plain text and html/rich text so when scripting out the content, the results may vary.
Lucky for me there wasn’t too many of them in my system. I actually expected more, but there was some 500+
.textClipping files and I decided after a few days of looking and testing that I should do these manually. It took a couple of three days - sitting a few hours each night. I just made a list of all in a file to see where each were located. Some were tricky, and some could just be deleted.
Now I only need to stay away from creating new ones (old habits).
Weblinks, url shortcuts
On most systems you can just drag the url from the address bar in your browser, and when it’s landing on the desktop or in a folder you get a shortcut. OS X have
.webloc, Windows are using
.url and Linux/*BSD are using the standard FreeDesktop with
The three different ones look something like this.
DuckDuckGo.webloc (OS X)
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>URL</key> <string>https://duckduckgo.com/</string> </dict> </plist>
DuckDuckGo.desktop (X desktops)
[Desktop Entry] Encoding=UTF-8 Type=Link Icon=text-html Name=DuckDuckGo URL=https://duckduckgo.com/
.texClipping some older files of
.webloc embeds the code/link in to the resource. Sometimes if not already in XML-format it can be converted in Terminal, and for the older ones you can use the same tool as mentioned above:
The difficult part here is not to convert the files, but to decide what file format to use. On could go with the
.url and make them useful in both Win, OSX and Linux. But I wanted to use the
.desktop - thinking, if the new ones later will be in that format I’ll go there now. And I have no plans to use Windows (especially now when Win 10 is out).
Only thing about using
.desktop I find somewhat annoying, is that there is a
.directory extension to use with links to folders, and that
.desktop are being use for programs etc. I’d really like to see another extension for web URL’s. But, since it’s standard - I’ll go with that.
Now, to convert these I needed a script. There’s no way that I was going to sit and manually convert 6000+
.webloc files. So, after some testing running single files, then testing on a few isolated directories - I finally converted all. All went fine and only 2 files I had to manually edit/convert afterwards.
I had setup so the ones that didn’t make it was put in a log file, and for all the ones that was successfully converted - the original
.webloc was deleted.
Here’s the script.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
Use it at your own risk. No warranties.
So, what it does… It finds all files and first convert them to XML, if they’re not. Then using
sed to get the value in/of
<string>. If they return empty, then
DeRez is used to see if the URL can be extracted. And finally, if it fails - the path/location of the file is added to the log file so I can deal with them later. If a new
.desktop was created, then the
.webloc is getting deleted.
These ones are not too bad if I make new ones before the move. They’re just XML files and I can manually edit them if I need to. The 6000+ files was necessary though, since many of them were in the old(er) format - embed as resource. Some were as old as from 1999/2000 (and forward) - when I bought my PowerMac G4. I hade a Mac Performa 5400 before that, but I can’t remeber how I did with the links when I moved into the new Mac.
.webloc files needs to be converted before (you move), unless you find a version of
DeRez you can compile on your GNU/Linux machine to work with. I didn’t, and I don’t expect the binary will work outside OS X. There is no other way to deal with
.textClipping files, except in OS X.