|
You might come across a situation where you need to rename lot of files with similar file names either by editing the file name or by truncating the last part of the file name. There are two ways by which you can accomplish the task.
Method 1:
You can use the "rename" command to rename multiple files in a single go.
Syntax:
rename from to file...
- from is the word that you want to change in the file name
- to is the word that you want to replace with
- file is the file that want to rename ( you can use regular expression to select multiple files here
Example:
rename .html .htm *.html
This will change the extension of all the html files present in the current directory. The from and to keywords need not be the last characters of the file names. It can be anywhere in the file names
Method 2:
This method utilizes the "for" loop and "mv" command to rename all the files in a single go.
The above script will change all the html file name from *.html to *.htm
salam kenal bos. lagi jalan jalan pagi nih
ReplyDelete