[SOLVED] Bulk Rename Help, Please

Questions about other topics - please check if your question fits better in another category before posting here
Forum rules
Before you post please read how to get help
Post Reply
InkingHubris
Level 1
Level 1
Posts: 20
Joined: Sat Apr 30, 2016 2:26 pm

[SOLVED] Bulk Rename Help, Please

Post by InkingHubris »

Hi y'all

I have done some searching and I have found similar problems but nothing that quite matched what I am after. I am hoping for some assistance here. If I have posted in the wrong area, my apologies.

I have 2750 files that have a file name of 0001-randomFileName.ext, all the way through 2764-randomFileName.etx

Before I unzip each file I want to rename them to only remove the 0001- part. The problem I have found between my issue and the other solutions is that my randomFileNames are just that... random. If I had "0001-file.zip", "0002-file.zip" etc it would be a more simple fix and I could use one of the solutions I Have found through my research into this matter.

However, because all of the actual filenames are indeed very different from one another a batch file rename isn't going to work (that I have found).

I just want to remove the numbers that precede the filenames and extensions. Is this possible through the command line or some program? I am just lazy and the thought of renaming by hand that many files is discouraging.

Thanks!
Last edited by InkingHubris on Sun Apr 22, 2018 1:59 pm, edited 1 time in total.
User avatar
Flemur
Level 19
Level 19
Posts: 9188
Joined: Mon Aug 20, 2012 9:41 pm
Location: Potemkin Village

Re: Bulk Rename Help, Please

Post by Flemur »

Try thunar:
rename.jpg
There's also a "Search and replace" (strings), though I've never had much luck with the "regular expressions" - they don't act the same way as in "vi".

Immediate edit: If you're not using Xfce, you should probably open it with

Code: Select all

thunar --bulk-rename
When the --bulk-rename option is specified no file managers windows will be opened, but instead the URIs will be passed to the bulk renamer. The bulk renamer allows to rename several files or folders at once using different renamer modules.
Edit2: the red names in the picture means they're going to over-write each other (end up with the same name), which wouldn't happen if the "randomFileName(s)" were different from each other.
Please edit your original post title to include [SOLVED] if/when it is solved!
Your data and OS are backed up....right?
User avatar
phd21
Level 19
Level 19
Posts: 9975
Joined: Thu Jan 09, 2014 9:42 pm
Location: Florida

Re: Bulk Rename Help, Please

Post by phd21 »

Hi InkingHubris,

I just read your post and the good replies to it. Here are my thoughts on this as well.

1.) This can easily be done using various renaming applications that can be installed through the Software Manager or Synaptic Package Manager (SPM). "Krename" and "Gwenrename" are my favorites.

Two sets of files... - Linux Mint Forums
viewtopic.php?f=18&t=266622&hilit=krename

2.) Using the Dolphin file manager was truly simple for this, select all the files in the folder (Ctrl+A) that you want renamed, then hit F2 (rename) or right-click and select rename, it comes up asking for a new filename with the # symbol afterward, put in whatever file name you want in the "NewFileName#" or "NewFileName####" with a number symbol as a suffix to prevent duplicates, it already shows start with "1", just click the Rename button.

Hope this helps ...

. Dolphin file manager step1 (select all and click F2 (rename))
Image
.
.Dolphin file manager step2 (entrer in the new filename and click rename)
Image
.
.
. Using Krename - one method.
Krename Step1
Krename Step1
.
Krename Step2
Krename Step2
.
. Simple Method
Image
.
.
OR a More complex option - Template explanation
[ ] brackets separate command functions
$=original file name
6;16 = start at position 6 of the original filename for length of 16 characters
To avoid having the same filenames by removing the existing filename prefixes, renumber the files by adding a filename suffix
####{1;1} = use four digits, starting with 1 through 9999
Krename Step3
Krename Step3
Last edited by phd21 on Sun Apr 22, 2018 3:44 pm, edited 9 times in total.
Phd21: Mint 20 Cinnamon & xKDE (Mint Xfce + Kubuntu KDE) & KDE Neon 64-bit (new based on Ubuntu 20.04) Awesome OS's, Dell Inspiron I5 7000 (7573) 2 in 1 touch screen, Dell OptiPlex 780 Core2Duo E8400 3GHz,4gb Ram, Intel 4 Graphics.
InkingHubris
Level 1
Level 1
Posts: 20
Joined: Sat Apr 30, 2016 2:26 pm

Re: Bulk Rename Help, Please

Post by InkingHubris »

Thanks for the replies guys!

I tried Thunar, worked flawlessly! I didn't have a problem (running 18.3 Cinnamon) with the GUI after install.

Will marked solved. Y'all are the best! I can move on to another project now! Much thanks! :mrgreen:
User avatar
Flemur
Level 19
Level 19
Posts: 9188
Joined: Mon Aug 20, 2012 9:41 pm
Location: Potemkin Village

Re: Bulk Rename Help, Please

Post by Flemur »

Oh, solved as I was posting this, cool!

For "The Others".....
There's also command-line "rename" (it won't rename more than one file to the same name, so I made the "random" parts unique):

Code: Select all

$ ls
0201-randomAFileName.ext  2763-randomCFileName.ext  2764-randomDFileName.ext
1302-randomBFileName.ext  2763-randomEFileName.ext 
$ rename  -v 's/^.....//' *
0201-randomAFileName.ext renamed as randomAFileName.ext
1302-randomBFileName.ext renamed as randomBFileName.ext
2763-randomCFileName.ext renamed as randomCFileName.ext
2763-randomEFileName.ext renamed as randomEFileName.ext
2764-randomDFileName.ext renamed as randomDFileName.ext
$ ls
randomBFileName.ext  randomDFileName.ext  randomAFileName.ext  
randomCFileName.ext  randomEFileName.ext
Please edit your original post title to include [SOLVED] if/when it is solved!
Your data and OS are backed up....right?
InkingHubris
Level 1
Level 1
Posts: 20
Joined: Sat Apr 30, 2016 2:26 pm

Re: [SOLVED] Bulk Rename Help, Please

Post by InkingHubris »

Hey!

More options and more information is never a bad thing!


Thanks again!
Post Reply

Return to “Other topics”