Support upgrading directories as well as files. Fixes #9