码迷,mamicode.com
首页 > 其他好文 > 详细

UNIX - Renaming a File

时间:2020-05-15 09:41:05      阅读:60      评论:0      收藏:0      [点我收藏+]

标签:like   dir   win   follow   rect   hang   complete   move   mat   

Unix does not have a command specifically for renaming files. Instead, the mv command is used both to change the name of a file and to move a file into a different directory.

To change the name of a file, use the following command format (where thirdfile and file3 are sample file names):

mv thirdfile file3

This command results in the complete removal of thirdfile, but a new file called file3 contains the previous contents of thirdfile.

Like cp, the mv command also overwrites existing files. For example, if you have two files, fourthfile and secondfile, and you type the command

mv fourthfile secondfile

mv will remove the original contents of secondfile and replace them with the contents of fourthfile. As a result, fourthfile is renamed secondfile, but in the process secondfile is deleted.

UNIX - Renaming a File

标签:like   dir   win   follow   rect   hang   complete   move   mat   

原文地址:https://www.cnblogs.com/JasperZhao/p/12892822.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!