Gabriel Dalimonte | 4b93d6e | 2025-02-17 13:26:44 -0500 | [diff] [blame] | 1 | .. SPDX-License-Identifier: GPL-2.0+: |
| 2 | |
| 3 | .. index:: |
| 4 | single: mv (command) |
| 5 | |
| 6 | mv command |
| 7 | ========== |
| 8 | |
| 9 | Synopsis |
| 10 | -------- |
| 11 | |
| 12 | :: |
| 13 | |
| 14 | mv <interface> [<dev[:part]>] <old_path> <new_path> |
| 15 | |
| 16 | Description |
| 17 | ----------- |
| 18 | |
| 19 | The mv command renames/moves a file or directory within a filesystem. |
| 20 | |
| 21 | interface |
| 22 | interface for accessing the block device (mmc, sata, scsi, usb, ....) |
| 23 | |
| 24 | dev |
| 25 | device number |
| 26 | |
| 27 | part |
| 28 | partition number, defaults to 0 (whole device) |
| 29 | |
| 30 | old_path |
| 31 | existing path to file/directory |
| 32 | |
| 33 | new_path |
| 34 | new path/name for the rename/move |
| 35 | |
| 36 | |
| 37 | Example |
| 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 | |
| 50 | Configuration |
| 51 | ------------- |
| 52 | |
| 53 | The mv command is only available if CONFIG_CMD_FS_GENERIC=y. |
| 54 | |
| 55 | Return value |
| 56 | ------------ |
| 57 | |
| 58 | The return value $? is set to 0 (true) if the file was successfully |
| 59 | renamed/moved. |
| 60 | |
| 61 | If an error occurs, the return value $? is set to 1 (false). |