z/OS UNIX System Services User's Guide
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Renaming or moving a file or directory

z/OS UNIX System Services User's Guide
SA23-2279-00

You can use the mv command to move or rename files. For example:
mv file1 file2
moves the contents of file1 to file2 and deletes file1. This is similar to:
cp file1 file2
rm file1
except that, when the files are in the same mountable file system, mv renames the file rather than copying it. file1 and file2 do not have to be in the same directory.

The mv command can move several files from one place to another.

For example:
mv file1 file2 file3 directoryb
moves all three files to directoryb.
Using the -R or -r option, you can move a directory and all its contents (files, subdirectories, and files in subdirectories) into another directory. For example:
mv -R directorya directoryb

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014