mv-moves or renames files

 <  Day Day Up  >  

mv ”moves or renames files

 mv [ f ] [ i ] filename1 [ filename2 ...] target 

The mv command moves a source filename to a target filename. The filename and the target may not have the same name . If target is not a directory, only one file may be specified before it; if it is a directory, more than one file may be specified. If target does not exist, mv creates a file named target . If target exists and is not a directory, its contents are overwritten. If target is a directory, the file(s) are moved to that directory.

Example A.38.
 1   mv file1 newname 2   mv -i test1 test2 train 

EXPLANATION

  1. Renames file1 to newname . If newname exists its contents are overwritten.

  2. Moves files test1 and test2 to the train directory. The “i switch is for interactive mode, meaning it asks before moving the files.

 <  Day Day Up  >  


UNIX Shells by Example
UNIX Shells by Example (4th Edition)
ISBN: 013147572X
EAN: 2147483647
Year: 2004
Pages: 454
Authors: Ellie Quigley

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net