文章目录
- overview
- mv file1 file2
- mv -i file1 file2 (saver usage version)
- mv dir1 dir2
- mv file1 file2 dir1
- useful options
overview
though the mv
command performs both file moving and file renaming,however,we could look it with a unified way:
with the effect of the mv,the name1 file/directory will no looger exist ,and the name2 file/directory will be exist.
mv file1 file2
将文件1移动到File2。 如果存在File2,则将其与File1的内容覆盖。 如果File2不存在,则会创建它。 在任何一种情况下,File1都不再存在。
Move file1 to file2. If file2 exists, it is overwritten with the contents of file1. If file2 does not exist, it is created. In either case, file1 ceases to exist.
mv -i file1 file2 (saver usage version)
Same as the previous command, except that if file2 exists, the user is prompted before it is overwritten.
mv dir1 dir2
If directory dir2 does not exist, create directory dir2 and move the contents of directory dir1 into dir2 and delete directory dir1.
(ok,you can consider it as rename the directory! at least ,the finally result is “the dir1 is renamed” )
If directory dir2 does exist, move directory dir1
(and its contents) into directory dir2.
mv file1 file2 dir1
Move file1 and file2 into directory dir1. The dierctory dir1 must already exist.
useful options