Megalextoria
Retro computing and gaming, sci-fi books, tv and movies and other geeky stuff.

Home » Digital Archaeology » Digital Archaeology » Batch rename files in Linux
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Batch rename files in Linux [message #374859] Fri, 19 October 2018 17:20
CyberkNight is currently offline  CyberkNight
Messages: 1503
Registered: July 2012
Karma: 0
Senior Member
Occasionally you will, for one reason or another, have a bunch of files that have filenames with a special character or some character that is giving you a problem for some reason. For instance, i had a bunch of image files named like "image #1.jpg" but the '#' character caused problems in the web based gallery program I was using. There are a million ways to batch rename files in Linux but the command 'mmv' offers a very simple method. I wanted to replace the ' #' with an '_' so the command was:

mmv "image #*" "image_#1"


The '#1' in the second parameter is expanded with whatever the wildcard ('*') gives you from the first. You can use multiple wildcards. For example:

mmv -c "report*part*.txt" "./french/rapport#1partie#2.txt"


Use the '-n' switch to preview your changes so that you know you constructed your command correctly.

For more info, see the man entry for mmv.


[Updated on: Fri, 19 October 2018 17:21]

Report message to a moderator

  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Archivists Grapple With Problems Of Preserving Recent Culture Held On Cassettes And Floppy Drives
Next Topic: Convert RAW to JPG in Mac terminal
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Tue Jul 14 11:57:31 EDT 2020

Total time taken to generate the page: 0.00391 seconds