Help with find and replace gui options for renaming many files

I am hopeless with regex and using sed etc. so am looking for a gui to edit file names for a directory full of files. These are in groups so a gui which would lend itself to editing groups of files using a find and replace approach within the directory would be ideal.
I cannot find any way to do this in Dolphin so if anybody can suggest a suitable app it would be much appreciated before I start.

Krename is a powerfull batch renamer, which is available in openSUSE standard repos. It takes some seconds to understand the countless possibilities of this tool, but you will really fast like it.

There’s also H2rename that I’ve been using for the last three years with great satisfaction. Usability is far better than Krename, in my opinion.

H2rename has several disadvantages:

  • not available in any official repo or linux distribution (reason see next points). It got deleted in all openSUSE repos
  • dead and unmaintained since 11 years!
  • it DOES NOT support regular expressions

Hi and many thanks for the reply. I have installed it and it all seems perfect for what I want but I may still have some regex to do.

My files are in the form:-

008 In_Our_Time_Archive_Science_-_IOTS_Antimatter_iots_20071004-0900a

and I want to rename them thus:-


The renamed files are shorter and simpler but my problem is that the numbers which prefix the title are not in sequence although all have three digits.

The next part of the title I just want to delete and then I want to add a colon after the IOTS which I can simply include in the replace string.

I believe I have to use a regexpression to handle the numerical prefix and space and then the remainder is simple text but I am struggling here. I don’t think I can mix regular expressions and text in the find line so If you can help it would be much appreciated. There were no examples or documentation that I could find.

BTW what does “Process tokens in replace string” mean?
Thanks again,

You can use the following template to cut everything before sign number 39. And then you append IOTS: in front. I made you a screenshot to show you what i mean. I used the base template (Light bulb “Functions” on right side) [$x;y]

I was not aware of the change. Thanks for the update. Now I’m worried about upgrading to 15.4.

Additionally a help how to find these setting/template:

Does prefix (that you want to remove) have exactly the same length in all files?

Actually, I found that the most convenient GUI is text editor - create list of filenames, edit them, prepend with “mv” and run as shell script. Does not require learning any new syntax beyond what is already known.

Better than I dared hope. I have been able to rename over 1000 files in just a few minutes. Your crib was essential but the tool is totally brilliant. I cannot thank you enough.
Many many thanks,

Hi and thanks for the reply. For the number and complexity of the file names it would have been hard work creating a list and no different from editing each file. The tool Hui suggested is brilliant and I shall install it on all my machines. Suggest you try it too if you have not already.

Apart from the fact that I do not use KDE, I do not need this tool because I am pretty comfortable with one liner shell script to do such renaming.

Actually, it is interesting psychological phenomenon. You say you are hopeless with regex, but you call “brilliant” a program that is effectively a fancy GUI for entering regular expressions.

There are no miracles. No program can read your mind and whatever you are using you will need to tell the program the exact criteria how to select parts of filename to remove and to keep and how to transform them. Which is exactly what regular expressions do, even if some particular program is using different syntax or calls them differently.

Besides I very often have to work on customer systems, so I prefer to stick to the least common denominators and learn how to use whatever is known to be universally available, not depend on some exotic tool.

But whatever works for you of course :slight_smile:

I never suggested editing each line individually. I meant using search and replace function that every editor I used provided.

1 Like

This tool which you knowingless call „a fancy gui“, has several advantages over your rudimentary texteditor proposal.

  • you can keep original file and create changed copies
  • it can rename, move, copy or whatever additional file operation in one step
  • it shows how the filename will look like before you do the change
  • it has countless aditional builtin plugins which can read out the metadata of any file and use it for file name cration
  • you don‘t need to know any syntax, as this tool gives you proposals and you directly can see in a preview how the result will look like: a massive amount of templates/tokens available

It needs some basic interest in learning something new. I also prefer mostly commandline for doing smt. But Krename beats the commandline as it compacts all operaters into one tool and you don‘t need to search the internet for it…
And it needs some open mind to understand and accept, that there are „fancy GUI tools“ existing that beats the terminal for some use cases.

Hi, I am returning here to ask my next question while I search and investigate the many plugins.
Your help has enabled me to sort out over 1000 file names and get them into good and consistent order. I am now having to sort out the tagging of a similar batch of radio downloads.
Is there any way I can edit the tag metadata for these files? I have tag editors; puddletag and easytag and they both have “scanner” tools but I have not yet found a way to trim title tags without changing the core title.
Not at machine right now so will post examples when I am at my own desk.

I do not quite understand what your problem is however exiftool is a very powerful tool which can be used in scripts to manipulate file tags.

This topic was handled and solved in the follow up thread:

Hi and thanks for your reply. I have used exiftool for solving some problems with my photo albums but in this case I was able to reduce the problem to the point where I could do the rest manually.

All good with Krename and have most of what I want in cleaning up my data files but I have bumped into another problem. I am trying to find the text from a cell in the subject column in another column and if it is present mark it in the first column so I can work on it later.
My problem is that the subject column is only the text I am looking for, the second column has additional data in the cell. My solution is to eliminate this additional data so I can search for the text only.
At this point I couldn’t work out how to use the Krename template to eliminate the unwanted data because both the text and the other data all are different with different numbers of characters so I thought I would go back to “Find and Replace” and use a regular expression.
This is an example of the cell I an trying to simplify:-
Fermats Last Theorem 25 Oct 12 iot 20121025-1130a.mp3.
I need to remove everything after ‘…Theorem.’ I tried the following expression but I really am out of my depth here and wonder if there is an easier way with Krename. Here is the expression I used in Find and Replace:-


I can show several regular expressions doing it for this string but without knowing rules how the names are formed we have no way to guess which one is suitable.

$ echo 'Fermats Last Theorem 25 Oct 12 iot 20121025-1130a.mp3' | sed -E 's/^(.*) [[:digit:]]{2} [[:alpha:]]{3} [[:digit:]]{2} .*(\.mp3)$/\1\2/'
Fermats Last Theorem.mp3

I have no idea what regular expression syntax Krename is using so I do not know what your expression does.