Read the guideline before start
Write an app that will move a file from one location to another like Linux mv
command: mv file.txt ./someDir/
(this will create file.txt
in ./someDir
and remove the source file).
- If a destination contains
/
in the end it must be considered as a directory. - In case destination directory does not exist an error must be thrown.
- The app must support only moving of files, and no additional options (flags).
Examples:
node index file.txt file2.txt
simply renames the file.node index file.txt ./existingDir/test
moves the file underexistingDir
with the nametest
.node index file.txt dir/
moves the file under thedir
. In casedir
does not exist an error is thrown.node index file.txt a
in casea
is an existing directoryfile.txt
will be moved to ./a/file.txt. Ifa
does not exist the file will be renamed to./a