Make sure the destination path exists
Make the program conform to the spec better
Use a buffer for reading and writing the files