Tuesday, September 27, 2016

Quick Schema from MySQL database

mysqldump -u root -p --no-data dbname > schema.sql

No data, just the table defs.

Saturday, September 3, 2016

Excluding "hidden" directories from Time Machine

I noticed I was making .75GB Time Machine backups when I hadn't really created any new content.  I don't back up my system, just my personal files and data.  I back up my dev stuff, even though it's in some sort of off-site, cloud-based source control.

I found this great tool, TimeTracker.app, that opens your Time Machine backups and tells you quickly what's in each.  I realized TM was backing up some homebrew directories (/var, /opt, /private) and some other system stuff.  The problem was that when I went to exclude them from the Time Machine preferences, the finder couldn't see these directories.  So I tracked down the plist file that stores all the TM prefs.  It was in

 /Library/Preferences/com.apple.TimeMachine.plist

I tried to edit that file, but it's a compressed/encrypted plist file.  I didn't want to mess with the uncompress/edit/compress process for every change.  I did find out that TextWrangler will edit compressed plist files.

Then I stumbled upon tmutil, a command line tool that will make changes to that file.  For example...

sudo tmutil addexclusion -p "/opt"

added that file to the exclude list.  Them can be removed with "removeexclusion".  You can even check if a single file or directory will be excluded with

sudo tmutil isexcluded "/Users/scott/bin"