Not much to say, look at the code experience.
[oracle@master test]$ cat test.sh
#!/bin/bash
file=test.sh
Echo "filename: ${file%.*}"
Echo "extension: ${file#*.}"
[oracle@master test]$ sh test.sh
File name: test
Extension: sh
[oracle@master test]$ cat test.sh
#!/bin/bash
file=test.tar.gz
Echo "filename: ${file%%.*}"
Echo "extension: ${file##*.}"
[oracle@master test]$ sh test.sh
File name: test
Extension: gz
_splitpath function In C or C++ programming, the path to obtain the program or file is often used, and the paths are split and merged. _splitpath and _makepath can accomplish this function. Func...
PHP to get the file extension? Original address: http://www.51ask.org/question/226 ...
lastIndexOf: is to search from right to left, return the index corresponding to the target element after finding the target element; return -1 if the target element is not found; In the programming, y...
go get the file name or extension language...
method Useos.path.splitext(file)[0] Availablefile name 。 useos.path.splitext(file)[-1] Can get. The beginningFile extension 。 code...
Code section: Output section: ...
Format:$ MV File/Folder Name New File/Folder Name Modify the file suffix in batches Batch modification file name Modify the folder name...