Nautilus Bulk Renaming - Is It Possible to Delete Everything After The Underscore?

I recently purchased, ripped, and almost finished transcoding the entire series of Friends. I'm currently in the process of converting subtitles with Subtitle Edit. I'd like to save myself a bit of work by taking the last 13-14 characters off the ends of the file names.

For example, I'd like to take track13[spa] off of the following filename: 03x10 - The One Where Rachel Quits_track13_[spa].sup

Or is this not possible with Nautilus?

0 points · 4 comments · view on lemmy.world

4 Comments

ictinus@lemmy.world · 2 pts · 3y (1 reply)

Assuming all but the number is the same in all file names, try this in a folder with a test file first....

rename 's/_track\d*_\[spa\]//' *

MrGeekman@lemmy.world · 2 pts · 3y

Thank you! I noodled around with that in a GUI program called GPRename and found a workable solution I just had to modify yours a bit to make it work there. Here's the finished solution, at least when using a graphical program like GPRename: _track\d*_\[eng\] *

oceanus_ursus@lemmy.world · 1 pts · 3y

This is something I'd probably do with a shell script. You can do it in a few intermediate stages. I'd start with putting together a script to dump the filenames to a text file and then some sed and awk to process that down to the final names. You could basically write a script to generate a script that you could inspect to see if it was correct before running it.

zikk_transport2@lemmy.world · 1 pts · 3y

Try asking chatgpt to write such bash script. Of you are not good at bash - ask to tell how to execute it too.