1# mv 2 3 4## Command Function 5 6This command is used to move files. 7 8 9## Syntax 10 11mv [_-fivn_] *SOURCE... DEST* 12 13 14## Parameters 15 16**Table 1** Parameter description 17 18| Parameter | Description | Value Range | 19| ------ | ------------------------------------------------------------ | ----------------------------------------------- | 20| -help | Displays help information. | N/A | 21| -f | Forcibly overwrites the target file. | N/A | 22| -i | Provides information before moving a file that would overwrite an existing file or directory. Enter **y** to overwrite the file or directory, and enter **n** to cancel the operation.| N/A | 23| -n | Do not overwrite any existing file or directory. | N/A | 24| -v | This parameter does not take effect although it is supported by the latest Toybox code. | N/A | 25| SOURCE | Specifies the file to move. | This command cannot be used to move a directory. It can be used to move multiple files at a time.| 26| DEST | Specifies the destination file path. | Both a directory and a file are supported. | 27 28 29## Usage Guidelines 30 31- **SOURCEFILE** supports wildcard characters * and ?. The asterisk (*) indicates any number of characters, and the question mark (?) represents a single character. **DEST** does not support wildcard characters. If the specified **SOURCE** matches multiple files, **DEST** must be a directory. 32 33- If **DEST** is a directory, this directory must exist. In this case, the destination file is named after the source file. 34 35- If **DEST** is a file, the directory for this file must exist. 36 37- If the destination file already exists, it will be overwritten. 38 39## Note 40 41Currently, the shell does not support this command. mksh supports it. To switch to mksh, run **cd bin** and **./mksh**. 42 43## Example 44 45Run the following commands: 46 47- mv -i test.txt testpath/ 48 49- mv test?.txt testpath/ (Move **test3.txt**, **testA.txt**, and **test_.txt**) 50 51 52## Output 53 54Example 1: Move a file. 55 56 57``` 58OHOS:/$ touch test.txt 59OHOS:/$ mkdir testpath 60OHOS:/$ touch testpath/test.txt 61OHOS:/$ mv -i test.txt testpath/ 62mv: overwrite 'testpath//test.txt' (Y/n):y 63OHOS:/$ ls 64bin etc proc storage testpath usr 65dev lib sdcard system userdata vendor 66OHOS:/$ cp testpath/test.txt ./ 67OHOS:/$ ls 68bin etc proc storage test.txt userdata vendor 69dev lib sdcard system testpath usr 70OHOS:/$ mv -i test.txt testpath/ 71mv: overwrite 'testpath//test.txt' (Y/n):n 72OHOS:/$ ls 73bin etc proc storage test.txt userdata vendor 74dev lib sdcard system testpath usr 75``` 76 77Example 2: Move files. 78 79 80``` 81OHOS:/$ ls 82bin etc proc storage test.txt testA.txt testpath usr 83dev lib sdcard system test3.txt test_.txt userdata vendor 84OHOS:/$ mv test?.txt testpath/ 85OHOS:/$ ls 86bin etc proc storage test.txt userdata vendor 87dev lib sdcard system testpath usr 88OHOS:/$ ls testpath/ 89test.txt test3.txt testA.txt test_.txt 90``` 91