Moving a file to a new location and renaming a file are the two functions of the mv command:
The second form is like the first, except that no filename is specified, just a target directory. In this case the source file is moved to the target directory, and the name of the source file is preserved.
If the target directory exists, the third form moves the source directory so that it is a subdirectory of the target. If the target directory does not exist, then the source directory is moved to the path specified in naming the target directory, and is given the target directory's name.
In both the first and third form, if the destination file/directory is in the same directory as the source file/directory, and the source and destination names are different, then the mv command has the effect of renaming the file/directory.