Keep parents of directories in keep_files

Closes #1297