bash: How to change file extensions
This post shows how to change file extensions using bash. To change file extensions, we simple need to loop through file in a directory and use the “mv” command to rename each file. The following code requests directory address from the user and then renames all “.log” files to...
bash: Renaming multiple files
To rename multiple files using the command line, you can use the rename command or a shell script. Its syntax is as follows. $ rename regular_expression files As you can see, the catch is that you need to know regular expressions. But for simpler tasks, regular expressions are really...
bash: renaming files in a directory
Suppose you have 2000 photos in a directory and you need to rename them. The files are named as: We need to rename them as follows: Here is how: j in is the counter. Line 5 increments j. s is a string. Line 4 uses the mv command renaming...