Skip to content
Advertisement

Tag: filenames

Renaming long file names in bulk

I have file names like: I want something like: Are there good ways to rename these files in linux? Answer You could try using a loop to extract the important part of the filename: This will simply give you a new list of filenames. You can then move them: To break this down a little: loop over the *.gz files

How to delete numbers, dashes and underscores in the beginning of a file name

I have thousands of mp3 files but all with unusual file names such as 1-2songone.mp3, 2songtwo.mp3, 2_2_3_songthree.mp3. I want to remove all the numbers, dashes and underscores in the beginning of these files and get the result: Answer This can be done using extended globbing: This uses parameter expansion: ${fname##pattern} removes the longest possible match from the beginning of fname.

Advertisement