Multi Rename Tool: Random number Random counter

English support forum

Moderators: white, Hacker, petermad, Stefan2

Post Reply
Perplexer
Junior Member
Junior Member
Posts: 53
Joined: 2007-09-22, 10:55 UTC

Multi Rename Tool: Random number Random counter

Post by *Perplexer »

I have a USB stick with MP3s on it and I would like to randomize the list of files on it by renaming them so that my no-name hardware MP3 player which doesn't support shuffle/randomize would play them in a quazi random order.

The idea is to just add a random two-digit number in front of each filename so that they get "randomized" and not sorted alphabetically anymore.

Is that possible with Multi Rename Tool ?
User avatar
Stefan2
Power Member
Power Member
Posts: 4132
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Lefteous Misc plugin Random Digits rename umbenenn tool MRT

Post by *Stefan2 »

You can install the misc plugin
http://www.totalcmd.net/plugring/misc.html


Then in MRT chose > Plugin > misc > random

so you get a new file name mask: [=misc.random] [N]

5 random digits plus origin name

- - -

Note that you can also use the common TC modifiers:

[=misc.random:1-2] [N] === 2 first digits
[=misc.random:2-3] [N] === 2 digits from the mid
[=misc.random:3-] [N] === 3 last digits
[=misc.random][=misc.random:1] [N] === 5+1 digits

Press F1 key while in MRT to read more.


.
Perplexer
Junior Member
Junior Member
Posts: 53
Joined: 2007-09-22, 10:55 UTC

Post by *Perplexer »

Thank you for your reply. I want to give this a try. Where do I put the three files that were in the ZIP file I downloaded from the link you provided ?
User avatar
milo1012
Power Member
Power Member
Posts: 1158
Joined: 2012-02-02, 19:23 UTC

Post by *milo1012 »

Erm, there is no need to install a plugin for that,
because a random number is part of the internal TC-plugin,
providing numbers between 0 and 99999.

The only drawback is that there are no "leading zeros" provided.

Code: Select all

[=tc.Random number]
Or, just like above, taking only a certain part of the number string.

Code: Select all

[=tc.Random number:1-3]

You could compensate for the missing leading zeros by using two fields at once:

Code: Select all

[=tc.Random number][=tc.Random number]
Which will get you up to ten digits that way.
(of course still having a probability that things like "0-9" are generated for each field, leading to just two digits combined)
Or, by using:

Code: Select all

[=tc.Random number:1][=tc.Random number:1][=tc.Random number:1][=tc.Random number:1][=tc.Random number:1]
which will ensure a 5 digit random number, but having a risk that you generate the same number more than once.
TC plugins: PCREsearch and RegXtract
Perplexer
Junior Member
Junior Member
Posts: 53
Joined: 2007-09-22, 10:55 UTC

Post by *Perplexer »

milo1012, great stuff. That works as well and is sufficient for what I need. Thanks.
Csimbi
Member
Member
Posts: 101
Joined: 2004-06-16, 08:27 UTC

Post by *Csimbi »

milo1012,
great info, thanks.

I am looking to generate a random string that contains all filesystem-safe characters (digits, upper- and lowercase letters, and a handful of other characters that not of the previous two).

I'd need it to encrypt filenames for other reasons than Perplexer's - so people would not be able to search for stuff of mine on the internet.

Is there a description of all built-in values somewhere?
The things I am looking for might already be in TC, too.

Thanks!
Best regards: Csimbi
User avatar
milo1012
Power Member
Power Member
Posts: 1158
Joined: 2012-02-02, 19:23 UTC

Post by *milo1012 »

Csimbi wrote:...generate a random string that contains all filesystem-safe characters...
AFAIK not with TC internal functions, but the mentioned misc plugin contains a field Random characters.
It seems to generate upper and lower case letters and numbers 0-9 in a random distribution.
So, I think you could do sth. like:

Code: Select all

[=misc.Random characters:1][=tc.Random number:1][=misc.Random characters:1][=tc.Random number:1][=misc.Random characters:1][=tc.Random number:1][=misc.Random characters:1][=tc.Random number:1][=misc.Random characters:1][=tc.Random number:1]
to mix both generators and produce things like:

Code: Select all

A8bZ0i3f...
Csimbi wrote:Is there a description of all built-in values somewhere?
Well, the help file has descriptions for the regular rename possibilities,
but if you mean the internal TC plugin, it seems that it's not documented. (but it's self-explanatory IMO)
TC plugins: PCREsearch and RegXtract
User avatar
solid
Power Member
Power Member
Posts: 747
Joined: 2004-08-09, 11:20 UTC

Post by *solid »

In Csimbi case, I would go with some hash generating plugins like LotsOfHashes for example.
Pr0metheus
New Member
New Member
Posts: 1
Joined: 2021-03-31, 11:20 UTC

Re:

Post by *Pr0metheus »

There are double numbers generated:

11. DJ Bobo - Let the Dream Come True.flac
12. 2 Brothers On The 4th Floor - Dreams.flac
12. Alan Walker - Fade.mp3
12. Culture Beat - Mr. Vain.flac
15. H.S.L. - Let Me Love You (Slight Mix).mp3
etc...

How to resolve this?
milo1012 wrote: 2014-09-04, 14:24 UTC Erm, there is no need to install a plugin for that,
because a random number is part of the internal TC-plugin,
providing numbers between 0 and 99999.

The only drawback is that there are no "leading zeros" provided.

Code: Select all

[=tc.Random number]
Or, just like above, taking only a certain part of the number string.

Code: Select all

[=tc.Random number:1-3]

You could compensate for the missing leading zeros by using two fields at once:

Code: Select all

[=tc.Random number][=tc.Random number]
Which will get you up to ten digits that way.
(of course still having a probability that things like "0-9" are generated for each field, leading to just two digits combined)
Or, by using:

Code: Select all

[=tc.Random number:1][=tc.Random number:1][=tc.Random number:1][=tc.Random number:1][=tc.Random number:1]
which will ensure a 5 digit random number, but having a risk that you generate the same number more than once.
User avatar
milo1012
Power Member
Power Member
Posts: 1158
Joined: 2012-02-02, 19:23 UTC

Re: Re:

Post by *milo1012 »

Pr0metheus wrote: 2021-03-31, 11:21 UTC There are double numbers generated:

11. DJ Bobo - Let the Dream Come True.flac
12. 2 Brothers On The 4th Floor - Dreams.flac
12. Alan Walker - Fade.mp3
12. Culture Beat - Mr. Vain.flac
15. H.S.L. - Let Me Love You (Slight Mix).mp3
etc...

How to resolve this?
So you used a 2-digit number?
In such case, the probability of having duplicate numbers is of course too high. The only chance to resolve this is by using more digits.
Or did you use the full 5-digit version but only showed the first few results?
In any case: you'd need to use more digits, but even then there is a small chance to generate the same number number more than once.

Unfortunately, the TC content-plugin interface doesn't allow a "session", meaning that it doesn't know which numbers were already issued.

So you either need to use an external script or tool for a true "unique" number, or probably simpler: make the random number based on the file hash.
E.g. use a simple file hash like CRC32 with a plug-in like this:
https://totalcmd.net/plugring/LotsOfHashes.html
Of course this wouldn't be a decimal number but a hex humber, but still be quite unique, as it's based on file content.
TC plugins: PCREsearch and RegXtract
Post Reply