07/31/12 12:43:21

Archive your movie disk without using much space.

On my vacation a friend told me how he archives a directory listing of the disks containing his movies for backup. Since movies can be replaced easily by redownloading the content, it’s normally not worth keeping a backup of the movies themselves somewhere.

I found that quite smart. I’ve been using ls -R to keep a history of my ~/Downloads for a while now, but wanted something that looks a bit nicer than ls.

Better output with tree

tree is a command line utility1 that lists directory contents in a tree-like structure, but has the disadvantage that when you output the command to a text file, the encoding throws off TextEdit.
Luckily some people point to this article by Murphy. He uses sed to format the output of find nicely:

find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'

The result looks pretty! To make this a command follow Sumedha’s instructions. Only replace the find line with the original from Murphy.

Then just type

`tree ~ > tree_home.txt`.


You can now automate the process with Hazel, Keyboard Maestro, or a Launch Agent (hint: Lingon).
It’s safe to run this command maybe once a day or a week. Honestly, how often do your movies change?

I use this command to output a file containing the date and time the command has run:

tree /Volumes/extHome/ > "$HOME/Documents/History/$(date "+%Y-%m-%d %H-%M") extHome.txt"


  1. Available in Homebrew, MacPorts and Fink.