Rename using the first 'num' characters from the [parent] name

Checked several very similar questions, but none quite match, or at least as I can understand them. A friend is recovering mp3s from a trashed drive. The recovery software is creating a directory structure with one file per dir, as this grab shows (files on the left, the parent dir on the right). If the files were tagged, then she could use the metadata to move all the files, but they aren't tagged.

She could select each 'group' of files and move them manually, but there are many thousands of files, so that is impractical.

If there was a way to use just the first x characters (5 in the example pic), of the [parent] she could move/rename every file into its matching parent. eg, all the 77377_001, 77377_002, 77377_003 etc, would be moved into the 77377 dir, then all the 77844 mp3s would be moved into 77844 and so on.

I know it can be done, but it's above my pay grade :slight_smile:

Try these parameters for the Advanced Renamer:

Mode: Regular Expressions
Old name: ^(\d{5}).*
New name: d:\OurNewHome\\\1\\\0
Ignore extension: checked

ta, checking...

hmm, that doesn't appear to do anything at all.

That's a little less than I had hoped :wink:

Maybe you can post a screenshot.

nope, my bad here... sorry. I just realised the files I am using don't match the examples. Now that I've made them match, things are happening. Apologies for jumping the gun (user error) :slight_smile:

hmm, works but... let me just double check.

Perfect. You are the man. Again. Sorry about my screw up using the wrong names. What a noob I am. Much appreciated. :+1:

If you feel like it, I'd love to know how this works. I guess the first bit is semi obvious even to a regex dunce (me) digit 5 something something, and then the dest is a path to start, but then....\1\\0? What does that mean or represent? I don't need or expect a tutorial on this, just a basic explanation if you feel so inclined.

\d is one digit, \d{5} is five of them. \1 represents to first capture group (\d{5}). \0 is the original file name. The backslashes for the path are escaped so there's no clash with the backslashes that follow.

ta. Appreciated :slight_smile: