Move the Files
As a part of your internship at a major tech company, you have been given the task of developing a file migration system. This system must be capable of moving all files from one directory to another, a task that the company currently performs manually, consuming considerable time and resources. Your challenge is to automate this process using Python.
The program should take as input two paths:
- the source directory from which the files should be moved,
- the destination directory where the files should be moved to.
The program should create the destination directory if it does not exist. It’s guaranteed that the source directory exists.
The program should print
File transfer successful
if all files have been moved successfully, or Error transferring files
if the operation could not be completed (if there was a file with the same name in the destination directory, or the move operation failed for some reason). If the operation cannot be completed successfully, no files should be moved.Input | Output |
source/path
destination/ | File transfer successful |
Constraints
Time limit: 2 seconds
Memory limit: 512 MB
Output limit: 1 MB