Help with find and replace gui options for renaming many files

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.

@Budgie2
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,
Alastair.

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.
Regards,
Alastair

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.
Regards,
Alastair.

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:-

'.*(\b[^\d\s]+).*'

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.

Hi and thanks for this. Sorry I omitted to state that Find and Replace was being used in libreoffice calc not Krename.
The text ‘Fermats Last Theorem’ (without the hyphen,) is the subject. If this is the name, it is not formed but the subject of a download. During the downloading process it has been supplemented by other data in a variety of formats which I am trying to remove. Depending on the age of the original there might be a date, characters such as ‘iot,’ dates in other formats and other numbers and letters so using sed would seem a good approach. Can I use this from within libreoffice calc or should I put the data into a text file first?.

If there can be anything then how you expect anyone to write an algorithm to remove it?

You got it backwards. It does not matter whether you use sed, Krename, LibreOffice Calc or anything else - you start with describing rules to perform matching and substitution. Only after you described these rules can you look whether your selected application supports them and if not, you chose another application. You do not start with selecting application expecting that it will read your mind.

Briefly looking at LO help, it seems to support super set of extended regular expressions, so it looks possible to do there (except it is using $ instead of \ for back-references).

I am looking at removing all the data after the text name, ie. the numbers and other characters after text but including the leading space before the numbers but excluding the .mp3.
The majority of lines have a number immediately following the title so I am thinking of using that as the starting logic for writing a rule.
Any exceptions could be sorted out manually.

To become a rule it needs to describe how to find the end of the name.

If “text name” cannot include a digit, it is rather trivial

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

If “text name” may include a digit, we are back at square one - either you need rules to find out where title ends or you need rules to find out where “junk” starts.

Understood but only a very few names include a number. My problem is that I have been using LO to clean up and sort my data so I want to operate on the column of cells in my spreadsheet. The original text file is more complex and I have been reducing the unwanted or superfluous data in LO. I shall press on. Many thanks.