View Full Version : Windows Explorer

10-21-2011, 03:29 PM
I have a folder with nearly 500 family photos. In Explorer they are sorted alphabetically. I want to put them onto a dvd, not as a slideshow but just as a bunch of photos, but want them randomized instead of alphabetically. There are all types of "sort" but no randomize. Any ideas? TIA

10-21-2011, 08:15 PM
:( Other than putting 001, 002, 003, in front of the photo name or description, it seems most burning software tends to alphabetize the pics. But I can see your dilemma as it would be a lot of work.

I hope someone who's done a similar thing speaks up soon.

What about setting up a screensaver app on the DVD? It would randomize for you.

Paul Komski
10-21-2011, 10:25 PM
There is a batch file that may do the trick for you. I would start by backing up the files in each intended directory before you begin. The file should run from whichever folder you place it in. The code is below if you don't want to download and test it; I haven't tested it.


ECHO Random Names
ECHO Written By: Jason Faulkner
ECHO HowToGeek.com

REM Randomly renames every file in a directory.

SETLOCAL EnableExtensions EnableDelayedExpansion

REM 0 = Rename the file randomly.
REM 1 = Prepend the existing file name with randomly generated string.
SET PrependOnly=0

REM 1 = Undo changes according to the translation file.
REM This will only work if the file "__Translation.txt" is in the same folder.
REM If you delete the translaction file, you will not be able to undo the changes!
SET Undo=0

REM --------------------------------------------------------------------------
REM Do not modify anything below this line unless you know what you are doing.
REM --------------------------------------------------------------------------

SET TranslationFile=__Translation.txt

IF NOT {%Undo%}=={1} (
REM Rename files
ECHO You are about to randomly rename every file in the following folder:
ECHO %~dp0
ECHO A file named %TranslationFile% will be created which allows you to undo this.
ECHO Warning: If %TranslationFile% is lost/deleted, this action cannot be undone.
ECHO Type "OK" to continue.
SET /P Confirm=
IF /I NOT {!Confirm!}=={OK} (
ECHO Aborting.

ECHO Original Name/Random Name > %TranslationFile%
ECHO ------------------------- >> %TranslationFile%

FOR /F "tokens=*" %%A IN ('DIR /A:-D /B') DO (
IF NOT %%A==%~nx0 (
IF NOT %%A==%TranslationFile% (
SET Use=%%~xA
IF {%PrependOnly%}=={1} SET Use=_%%A

ECHO %%A/!NewName!>> %TranslationFile%

RENAME "%%A" "!NewName!"
) ELSE (
ECHO Undo mode.
IF NOT EXIST %TranslationFile% (
ECHO Missing translation file: %TranslationFile%
FOR /F "skip=2 tokens=1,2 delims=/" %%A IN (%TranslationFile%) DO RENAME "%%B" "%%A"
DEL /F /Q %TranslationFile%

10-21-2011, 11:29 PM
but I think after I finish Photoshopping all of them, with text and sharpen, etc., I will make a copy of the folder and download this program. At least I'll look and see if I can understand it. I'm pretty good on the computer but when it comes to code and programming, well, that's a whole 'nother matter. You've never steered me wrong before, Paul, so hopefully I can make it work.
Thanks for your ideas.

Paul Komski
10-22-2011, 03:51 AM
The file/script works just fine for me in WinXP and creates a list of renamed files that retains only the original file extension. The renamed name is a sequence of three random numbers separated by two hyphens such as 26531-486-4077. If you want the original filename to be retained and the random string simply prepended to it then you must edit the batch file in a text editor so that SET PrependOnly=0 becomes SET PrependOnly=1 and an equivalent change to cause the undo action with SET Undo=0 becoming SET Undo=1. Its easy to practice for a while with a few files in a test folder.

If you enter ECHO %RANDOM% into a command prompt you will see the range of raw random numbers that the batch file can generate. If you want to enter the same command consequtively next hit the up arrow followed by Enter again.

10-22-2011, 11:51 PM
you're waaay beyond me now. I think I'll try the download program and try a dozen or so files to see if it's what I need (and can handle).
Thx for your help.

Paul Komski
10-23-2011, 12:02 AM
It's actually a pretty straightforward script even if it looks a bit complicated. Post back if you need/want help editing anything.

Batch (.bat) files are executables written as text files and that have lines of code that include command prompt commands within them.

FYI the command ECHO asks that the results are displayed on the screen and %RANDOM% is a system variable that simply generates a random number.

There are of course loads of commands (http://ss64.com/nt/) and if you ever want to know the options for each command just enter the actual command followed by /?

10-23-2011, 04:18 PM