Fix rename-file to handle directory renaming properly (Bug#3353).