Breadcrumbs 
Learning >> Documentation >> File System >> Moving files
 
Recent News
We Want You!
Come and get involved! (And Christmas Party!
[ more ]
Make your own Xbox games!
Learn to make Xbox 360 games
[ more ]
New Committee
A new committee has been appointed.
[ more ]
Moving files
Moving files

mv [source] [destination]

The "mv" command has two functions. It can move a file from one directory to another, or change the name of a file.

$ mv current_project march_project

This will rename the file current_project to march_project.

$ mv march_project ../accounting

This moves the file called march_project one directory higher and into the accounting directory. Again be very careful, if the detination file already exists, it will be overwritten and you will lose all data that file contained.

$ mv -i march_project ../accounting
mv: overwrite '../accounting/march_project'? n

The "-i" option will make the mv command check to see if a file already exists and ask you to confirm you want to overwrite it. Enter 'y' for yes or 'n' for no.

Lets have a look at a few examples:

# moves the file into the psychology_due/ directory
$ mv project2.txt psychology_due/

# moves the file one directory higher
$ mv project1.txt ..

# moves the file up one directory and into the 2003 directory
$ mv project3.txt ../2003/

# moves all .txt files into the notes directory
$ mv *.txt notes/

Lets find out how to make and remove directories.