Complete some file-manipulation functions