Handle directories as destination paths

Fixes #294.