If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
rename photo by random size
Is there a program that can rename a directory of photos randomly?
Perhaps by size? Or by last access? Or by number of colors. Whatever. Almost none have exif so rename by exif would be nice but won't work. Most renames like iv seem to rename based only on file name. |
#2
|
|||
|
|||
rename photo by random size
On 15 Dec 2018, Jean Fredette wrote in
alt.windows7.general: Is there a program that can rename a directory of photos randomly? Perhaps by size? Or by last access? Or by number of colors. Whatever. Almost none have exif so rename by exif would be nice but won't work. Irfanview has many bulk rename options. Check it out. |
#3
|
|||
|
|||
rename photo by random size
On Sat, 15 Dec 2018 14:13:58 -0600, Jean Fredette
wrote: Is there a program that can rename a directory of photos randomly? Perhaps by size? Or by last access? Or by number of colors. Whatever. Almost none have exif so rename by exif would be nice but won't work. Most renames like iv seem to rename based only on file name. "Randomly" might make it tricky, but for all of my bulk renaming chores I turn to Bulk Rename Utility. https://www.bulkrenameutility.co.uk/Main_Intro.php If I wanted to rename based on size, I'd simply click the size column header, then apply an incrementing serial number to each file as a prefix. For example, once the files have been sorted by size or date accessed, I'd specify a prefix of 101 or 1001, depending on the number of files, increment 1, separator " - ", and let'er rip. Later, if you want to name them by a different criteria, you can easily remove the serial number, do the sort another way, and reapply a serial number. BRU is insanely configurable. -- Char Jackson |
#4
|
|||
|
|||
rename photo by random size
"Randomly" might make it tricky, but for all of my bulk renaming chores I turn to Bulk Rename Utility. https://www.bulkrenameutility.co.uk/Main_Intro.php If I wanted to rename based on size, I'd simply click the size column header, then apply an incrementing serial number to each file as a prefix. For example, once the files have been sorted by size or date accessed, I'd specify a prefix of 101 or 1001, depending on the number of files, increment 1, separator " - ", and let'er rip. Later, if you want to name them by a different criteria, you can easily remove the serial number, do the sort another way, and reapply a serial number. BRU is insanely configurable. Thank you for BRU suggestion which helped me find these to test. BRU https://www.bulkrenameutility.co.uk/Download.php AdvancedRenamer https://www.advancedrenamer.com/ RenameExpert https://www.rename-expert.com/featur...ile_names.aspx |
#5
|
|||
|
|||
rename photo by random size
In message , Jean Fredette
writes: Is there a program that can rename a directory of photos randomly? Do you mean rename the directory, or the files within it? Perhaps by size? Or by last access? Or by number of colors. Whatever. Almost none have exif so rename by exif would be nice but won't work. IV can rename by file size ($S), number of megapixels ($m) ... presumably those don't use exif data. Most renames like iv seem to rename based only on file name. Au contraire (-: -- J. P. Gilliver. UMRA: 1960/1985 MB++G()AL-IS-Ch++(p)Ar@T+H+Sh0!:`)DNAf Q. How much is 2 + 2? A. Thank you so much for asking your question. Are you still having this problem? I'll be delighted to help you. Please restate the problem twice and include your Windows version along with all error logs. - Mayayana in alt.windows7.general, 2018-11-1 |
#6
|
|||
|
|||
rename photo by random size
posted:
IV can rename by file size ($S), number of megapixels ($m) ... presumably those don't use exif data. I want to rename the files not the directory. If IV renamed randomly I am fine but I long tried IV doing this. What is wrong with my test of IV rename by file size? I open one jpeg file in the directory to IV. I press the "b" key to begin batch operation. I press "options" in the "batch rename settings" part. There are no related options to rename based on file size. (The batch rename order will be based on the original filename order.) Is there some other bulk rename feature somewhere else in IV? It doe not need to rename with pure random but it should not be based on alphabetical order. |
#7
|
|||
|
|||
rename photo by random size
In message , Jean Fredette
writes: posted: IV can rename by file size ($S), number of megapixels ($m) ... presumably those don't use exif data. I want to rename the files not the directory. If IV renamed randomly I am fine but I long tried IV doing this. What is wrong with my test of IV rename by file size? I open one jpeg file in the directory to IV. I press the "b" key to begin batch operation. I press "options" in the "batch rename settings" part. So far so good ... There are no related options to rename based on file size. (The batch rename order will be based on the original filename order.) Is there some other bulk rename feature somewhere else in IV? It doe not need to rename with pure random but it should not be based on alphabetical order. In the window that opens when you click Options, headed "Batch rename settings", click Help. Scroll down. You will see $S - file size, and $m - number of megapixels. So close the help, and change whatever's in the "Name pattern" box to $S. Now select your files, and start renaming ... This is IV 4.51, but I think it's been the same for a while. -- J. P. Gilliver. UMRA: 1960/1985 MB++G()AL-IS-Ch++(p)Ar@T+H+Sh0!:`)DNAf This was before we knew that a laboratory rat, if experimented upon, will develop cancer. [Quoted by] Anne ), 1997-1-29 |
#8
|
|||
|
|||
rename photo by random size
posted:
In the window that opens when you click Options, headed "Batch rename settings", click Help. Scroll down. You will see $S - file size, and $m - number of megapixels. So close the help, and change whatever's in the "Name pattern" box to $S. Now select your files, and start renaming ... This is IV 4.51, but I think it's been the same for a while. I only later understood what you are trying to tell me. Let me write what happens with IV 4.5.1 - 32 bit as I try slowly. I open up a directory of a few thousand images of various types. I only want to rename the base file name and keep original extensions. I do not want the current order of the file names which is alphabetical. I want the order of file names to be random (or at least mostly random). I click twice on a file to open it up in iv which is my default pic viewer. I press the "b" keyboard key to begin batch mode. The "Batch conversion" window opens up. I press the "Add all" button to add all the thousands of image files. Under the heading of "Batch rename settings" is a "Name pattern". To the right of that name pattern is an "Options" button. I click that Options button which has a "Name pattern" again. To the right of the "$N" and "#" example is a "Help" button. I press that "Help" button which brings up "Text/Pattern Options" help. Some of those text pattern options are below. $S - file size $m - number of megapixels $B - image bits per pixel $p - image DPI $R - image aspect ratio (width / height) $I - all IPTC data Closing that Help I try this pattern Name pattern: $S$m$B$p$R$I### And then I press the "Start Batch" button. That gives me random file names of 497.88 KB1.19 MP2496(0.87)001.jpg 473.31 KB1.12 MP2496(1.65)002.jpg 810.52 KB2.35 MP2496(0.95)003.jpg 608.40 KB1.81 MP2496(1.24)004.jpg 487.22 KB1.32 MP2496(1.94)005.jpg 1023.52 KB1.97 MP2496(1.14)006.jpg 924.00 KB2.12 MP2496(0.49)007.jpg 407.16 KB0.61 MP2496(1.72)008.jpg 591.69 KB0.93 MP2496(1.12)009.jpg 417.45 KB0.78 MP2496(1.34)010.jpg 259.61 KB0.44 MP2496(2.37)011.jpg 449.83 KB0.99 MP2496(1.05)012.jpg 591.44 KB0.96 MP24300(1.09)013.jpg 558.63 KB0.98 MP2496(1.07)014.jpg 569.74 KB1.13 MP2496(0.92)015.jpg Now that the file name order is random, I can run another batch rename Name pattern: image### Now the images are in a pseudo random order. It works ok. Thank you for helping me find the other randomizing values! |
#9
|
|||
|
|||
rename photo by random size
"Jean Fredette" wrote
| Is there some other bulk rename feature somewhere else in IV? | It doe not need to rename with pure random but it should not be based on | alphabetical order. I see the default option as image1, image2, etc. You seem to want to make the names non-informative. Isn't that a good method? If you were to rename based on size or file time you'd need to deal with possible repetitions. You'd also need to access the file to do it. |
#10
|
|||
|
|||
rename photo by random size
posted:
I see the default option as image1, image2, etc. You seem to want to make the names non-informative. Isn't that a good method? I do not actually care what the image name is. It just needs to be randomly ordered. Let's take a made up example of the following pictures a white cow another white cow yet another cow horse chicken another chicken dog a big dog cat a small cat a brown cow I want the order of those to be random kind of like this horse another white cow cat another chicken dog a brown cow chicken a white cow a big dog yet another cow a small cat The order doesn't have to be "really" random. Just not in the original order which had groupings of similar pictures. I want to break up the groupings of similar pictures. The final result can be any name as long as the order is "random". image001 which was horse image002 which was another white cow image003 which was cat image004 which was another chicken image005 which was dog image006 which was a brown cow image007 which was chicken image008 which was a white cow image009 which was a big dog image010 which was yet another cow If you were to rename based on size or file time you'd need to deal with possible repetitions. You'd also need to access the file to do it. I found this batch script which I think handles repetitions. @ECHO OFF ECHO Random Names ECHO Written By: Jason Faulkner ECHO HowToGeek.com ECHO. ECHO. 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. 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. ECHO Aborting. GOTO :EOF ) 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 SET NewName=!RANDOM!-!RANDOM!-!RANDOM!!Use! ECHO %%A/!NewName! %TranslationFile% RENAME "%%A" "!NewName!" ) ) ) ) ELSE ( ECHO Undo mode. IF NOT EXIST %TranslationFile% ( ECHO Missing translation file: %TranslationFile% PAUSE GOTO :EOF ) FOR /F "skip=2 tokens=1,2 delims=/" %%A IN (%TranslationFile%) DO RENAME "%%B" "%%A" DEL /F /Q %TranslationFile% ) |
#11
|
|||
|
|||
rename photo by random size
Jean Fredette wrote:
posted: I see the default option as image1, image2, etc. You seem to want to make the names non-informative. Isn't that a good method? I do not actually care what the image name is. It just needs to be randomly ordered. Let's take a made up example of the following pictures a white cow another white cow yet another cow horse chicken another chicken dog a big dog cat a small cat a brown cow I want the order of those to be random kind of like this horse another white cow cat another chicken dog a brown cow chicken a white cow a big dog yet another cow a small cat The order doesn't have to be "really" random. Just not in the original order which had groupings of similar pictures. I want to break up the groupings of similar pictures. The final result can be any name as long as the order is "random". image001 which was horse image002 which was another white cow image003 which was cat image004 which was another chicken image005 which was dog image006 which was a brown cow image007 which was chicken image008 which was a white cow image009 which was a big dog image010 which was yet another cow If you were to rename based on size or file time you'd need to deal with possible repetitions. You'd also need to access the file to do it. It sounds like you're trying to override the playback order in a screensaver, picture frame, or smart TV. By appending a prefix to the file name, the alphabetical order can be overridden. 001_horse 002_another_white_cow 003_cat 004_another_chicken 005_dog 006_a_brown_cow 007_chicken 008_a_white_cow 009_a_big_dog 010_yet_another cow 011_a_small_cat On a later incantation, you might seek 001_another_white_cow 002_dog and that's the order they will play in. Here is a deck shuffling code. When solving a problem, first I look for some code I can borrow. https://www.rosettacode.org/wiki/Knuth_shuffle#AWK You can make a script generator in awk (gawk). dir input.txt gawk -f shuffle2.awk input.txt output.txt notepad output.txt # visual check all is good ren output.txt output.bat output.bat # do the rename in Command Prompt # The rename can be done from AWK # but it's a bit clumsy. Now, all you have to do, is write the program. I'm using the KISS principle here, to keep scripting time to 30 minutes or less. Borrowing a little code, saves time. ******* shuffle2.awk MSDOS batch generator ******* # Program to shuffle filenames. # Can be applied to the directory, again and again. # # Input: # # hello.jpg # A brand new file added to the directory # 0001__goodbye.jpg # An old file needing renaming without hdr addn # # Output: # # ren 0001__goodbye.jpg 0001__goodbye.jpg # the order is random # ren hello.jpg 0002__hello.jpg # a second run will flip the order # # For interactive input, type ctrlz to indicate end of stdin # # gawk -f shuffle2.awk # gawk -f shuffle2.awk input.txt my_msdos_bat.bat BEGIN { srand(systime()) # seed using epoch time in seconds maxfiles = 10000 # a power of ten, for number plan # stick to a scheme once started!!! # 0000__ 0001__ ... 9999__ headlen = 6 for (k=1; k10000; k++) { prechk[ sprintf("%04d__", k) ] = k } # catch reused headers k=1 # use as input counter } # Shuffle an _array_ with indexes from 1 to _len_. # Reuse: https://www.rosettacode.org/wiki/Knuth_shuffle#AWK # function shuffle(array, len, i, j, t) { for (i = len; i 1; i--) { # j = random integer from 1 to i j = int(i * rand()) + 1 # swap array[i], array[j] t = array[i] array[i] = array[j] array[j] = t } } { array[ k++ ] = $0 } # load list of filenames from stdin END { k-- # correct overshoot by one shuffle( array, k ) # for (m = 1; m = k; m++) { head = substr( array[m], 1, headlen ) totlen = length( array[ m ] ) tail = substr( array[m], 7, totlen-6 ) if (head in prechk) { # substitute out the lead chars printf( "ren %s %04d__%s\n" , array[ m ], m, tail ) } else { # add new scheme as prefix to name printf( "ren %s %04d__%s\n" , array[ m ], m, array[m] ) } } } ******* shuffle2.awk MSDOS batch generator ******* Gawk.exe is available here, in the binaries section. This program should not need any library DLLs and is (thankfully) self-contained. http://gnuwin32.sourceforge.net/packages/gawk.htm Gawk version 4 is available in Windows 10, in the Linux Bash environment. This Gawk 3 version from gnuwin32 however, is actually "Windows friendly" on line endings, which is why I'm still using it. Paul |
Thread Tools | |
Display Modes | Rate This Thread |
|
|