Miss Val (tinebrella) wrote in psychedelicats,
Miss Val

Behold the folder randomizer!

It doesn't matter if the folder contains images, fonts, or any mix of file types.
The randomizer goes through the folder and its subfolders (and the subfolders of its subfolders, and the subfolders of the subfolders of its subfolders, and the... you get the idea) and copies a certain number of files to another folder. You pick the number and the source folder, the randomizer does the rest.

Download HERE @ box.net
Tested on Win 7 & Win 10. If you need the Mac version just ask, I'll provide it, but I cannot test it so you'll be on your own if it doesn't work >:

Inside the .zip you will find a folder named Randomizer. Open the folder.
Don't be scared by all the .dlls you'll find inside, they were put there when I generated the .exe file so that no installation is needed - I guess? I mean, that's a baffling number of dependencies for a program that does precious little, but whatever.

The only files you're interested in are:
- appsettings.json: the file you'll need to edit to configure the Randomizer - it's just a text file, you can open it with a text editor (I use Notepad++ which is awesome, but the regular Notepad will do just fine)
- ScreencapRandomizer.exe: the actual .exe file you need to execute to do the randomizing - nevermind the name, I named it when I thought all I wanted to do was randomize screencaps

Open the file appsettings.json in a text editor.
Inside you'll find something like this:

The names are pretty straightforward, but here's an explanation anyway:
- sourceDirectory: it's the source folder, the one that contains the files you want to randomize
- outputDirectory: it's the destination folder, the one that will be created and contain the randomized files
- howMany: it's the number of randomized files that you want the randomizer to pick from the source directory and copy (NOT cut!) to the output directory
Make sure to use the double backward slash in the paths as you see in the screenshot above!

Run the .exe file. It will open a console and tell you what it's doing.
It will look like this:

When it's done, press any key on your keyboard or just close the console.
You will get a folder with a name like "Randomized_Enola_6f1a94d5-3c80-4fe3-85b6-7ad3708ab246": you can get rid of the id part ("_6f1a94d5-3c80-4fe3-85b6-7ad3708ab246").

Please note that some issues are accounted for:
- if the destination folder already exists: it won't overwrite it nor you will get an error, it will just create a new folder - that's why you get the unique id after the name of the folder you specified in outputDirectory
- if it picks the same file twice or multiple times (it happens, it's random): it will just overwrite it in the destination folder, which means you might get a slighlty lower number of files than the number you put in howMany
- if you specify a source folder that does not exists (or if you provide a wrong path): it will just tell you what went wrong, and you can close the window and run the randomizer again
- if you pick a number that is higher than the total number of files in the source folder: it will just tell you what went wrong, and you can close the window and run the randomizer again

What if the issue you run into is not accounted for? Never fear, the randomizer will get mad, but will not blow up in your face, it will just tell you that an exception occurred - it might look like gibberish, but don't be scared, leave a comment with the exception and a screenshot of your appsettings.json file and I'll tell you what went wrong (hopefully?).

Tags: !maker: tinebrella, *tools

  • Post a new comment


    default userpic

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.