Today we will introduce a file name transcoding tool-convmv. convmv helps us easily encode and convert all files in one file and directory, such as converting gbk to utf8. Install yuminstallconvmv syntax: convmv [options] FILE (S)... DIRECTORY (S) main options: 1.-fENCODING specifies the encoding of the current FILE name, such as-f
Today we will introduce a file name transcoding tool-convmv. convmv helps us easily encode and convert all files in one file and directory, such as converting gbk to utf8.
Install yum install convmv
Syntax:
Convmv [options] FILE (S)... DIRECTORY (S)
Main options:
1.-f ENCODING
Specifies the encoding of the current file name, such as-f gbk.
2.-t ENCODING
Specifies the encoding to be converted to, such as-f UTF-8.
3.-r
Recursively convert all file names in the directory
4. -- list
List all supported codes
5. -- notest
By default, only the converted effect is printed. this option is used to perform the conversion operation.
Common parameters:-r recursively processes subfolders-notest to perform real operations. by default, files are not actually operated.-list displays all Supported encodings-unescap can be escaped, for example, to change % 20 to space-I interaction mode (ask every conversion to prevent misoperation) convmv usage: convmv-f source code-t new encoding [option] file name example: after this conversion, the "GBK encoded file name" will be converted to UTF-8 encoding (only the conversion of file name encoding, the file content will not change ). Note: Do not use this command in the NTFS and FAT file systems. otherwise, unexpected results may occur. if you want to correctly display the NTFS and FAT file names in Linux, the mount parameter can be used to solve the problem. For more information, see the man manual.
Example:
Recursive conversion the current file name under the centos directory is encoded as gbk UTF-8:
- Convmv-f gbk-t UTF-8 -- notest-r centos
2. Sample Code: convmv-f GBK-t UTF-8 -- notest-r 303i.com/* (303i.com/when is the current directory of the file to be converted)