summaryrefslogtreecommitdiff
path: root/doc/usage/cmd/mv.rst
blob: 99864371038f18071c2157440e8a5043d87ed6ac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
.. SPDX-License-Identifier: GPL-2.0+:

.. index::
   single: mv (command)

mv command
==========

Synopsis
--------

::

    mv <interface> [<dev[:part]>] <old_path> <new_path>

Description
-----------

The mv command renames/moves a file or directory within a filesystem.

interface
    interface for accessing the block device (mmc, sata, scsi, usb, ....)

dev
    device number

part
    partition number, defaults to 0 (whole device)

old_path
   existing path to file/directory

new_path
   new path/name for the rename/move


Example
-------

    # Rename file 'foo' in directory 'dir' to 'bar'
    mv mmc 0:0 dir/foo dir/bar

    # Move file 'f' from directory 'foo' to existing directory 'bar' renaming
    # 'f' to 'g'
    mv mmc 0:0 foo/f bar/g

    # Move directory 'abc' in directory 'dir1' into existing directory 'dir2'
    mv mmc 0:0 dir1/abc dir2

Configuration
-------------

The mv command is only available if CONFIG_CMD_FS_GENERIC=y.

Return value
------------

The return value $? is set to 0 (true) if the file was successfully
renamed/moved.

If an error occurs, the return value $? is set to 1 (false).