blob: 99864371038f18071c2157440e8a5043d87ed6ac [file] [log] [blame]
Gabriel Dalimonte4b93d6e2025-02-17 13:26:44 -05001.. SPDX-License-Identifier: GPL-2.0+:
2
3.. index::
4 single: mv (command)
5
6mv command
7==========
8
9Synopsis
10--------
11
12::
13
14 mv <interface> [<dev[:part]>] <old_path> <new_path>
15
16Description
17-----------
18
19The mv command renames/moves a file or directory within a filesystem.
20
21interface
22 interface for accessing the block device (mmc, sata, scsi, usb, ....)
23
24dev
25 device number
26
27part
28 partition number, defaults to 0 (whole device)
29
30old_path
31 existing path to file/directory
32
33new_path
34 new path/name for the rename/move
35
36
37Example
38-------
39
40 # Rename file 'foo' in directory 'dir' to 'bar'
41 mv mmc 0:0 dir/foo dir/bar
42
43 # Move file 'f' from directory 'foo' to existing directory 'bar' renaming
44 # 'f' to 'g'
45 mv mmc 0:0 foo/f bar/g
46
47 # Move directory 'abc' in directory 'dir1' into existing directory 'dir2'
48 mv mmc 0:0 dir1/abc dir2
49
50Configuration
51-------------
52
53The mv command is only available if CONFIG_CMD_FS_GENERIC=y.
54
55Return value
56------------
57
58The return value $? is set to 0 (true) if the file was successfully
59renamed/moved.
60
61If an error occurs, the return value $? is set to 1 (false).