Rename groups of files in Linux

To rename files in Windows as in Linux, there are numerous programs created for this purpose and equipped with graphical interfaces are often very simple to use, just find a quick search on Google or another search engine, many are free, but If you are interested to know some bash scripts which perform the same operation, Here is the step to follow:

The first project involves the use of a simple loop that counts the images to be renamed, and the flow stops only when all required actions were carried out:

<span onmouseover="_tipon(this)" onmouseout="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left;">for i in *.htm; do mv $i.html; done</span> for i in *. htm; do mv $ i.html; done</span>

A variant of the proposal involves the introduction of the basename command that eliminates any sufisso with the final “/” prefix or a string:

<span onmouseover="_tipon(this)" onmouseout="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left;">for i in *htm; do mv $i 'basename $i htm' html; done</span> for i in * htm; do mv $ i 'basename $ i htm' html; done</span>

A final solution is rather based on the use of regular expressions and rename command launched from inside a command line:

<span onmouseover="_tipon(this)" onmouseout="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left;">rename 's/\.htm$/.html/' *.htm</span> rename 's / \. htm $. / html /' *. htm</span>

Again, all pages with “. Htm” will be renamed. “Html”.

Related posts:

  1. Share swap between Linux and Windows
  2. CD to ISO with LINUX
  3. Using the conditions for query UPDATE
  4. Restore the sound on Linux
  5. Calculate the size of a MySQL database
  6. Validate the value of a hex color with PHP
  7. Restrict input length of the DB field to park
  8. Enter PHP in JavaScript
  9. Disable submit button with JavaScript
  10. Timing redirect with PHP
This entry was posted in Linux and tagged , , . Bookmark the permalink.

Comments are closed.