How to? Select 100 random pictures from 30,000

Jan 16, 2009
45
0
I have about 30,000 pictures on a HD. I want to randomly copy about 100 to another folder. Then I will copy them to a memory card so can view them on a dedicated picture display.
 
May 20, 2008
11,530
102
Syracuse, NY, USA
Put their names in a file (maybe DIR /k /n /b /s > file). Then randomly pick lines in the file with %@line[file,%@random[0,29999]] until you've picked 100 different ones.
 

samintz

Scott Mintz
May 20, 2008
1,511
18
Solon, OH, USA
That's probably a good start, except that it is possible to get repeats. So you'll need a two-step solution. One that generates a list of unique numbers and the second that pulls an indexed named from the list of names.
 
May 20, 2008
473
2
To avoid repeats in the version Vince mentioned, copy as you select, but check if not exist before the copy and decrement a counter after copy. Repeat until the counter reaches zero.
 

samintz

Scott Mintz
May 20, 2008
1,511
18
Solon, OH, USA
Nifty. You can actually include the /head directly in the tpipe command:
Code:
dir /a:-d /b | tpipe /simple=39 /head=0,0,100

I did run into an issue with @con trying to do
Code:
dir /a:-d /b | tpipe /simple=39 /head=0,0,100 | copy @con: nul

@con => nul
TCC: (Sys) The system cannot find the file specified.
 "@con"
     0 files copied       1 failed

Shouldn't that work?
 

samintz

Scott Mintz
May 20, 2008
1,511
18
Solon, OH, USA
I get similar woes if I use CLIP:
Code:
dir /a:-d /b | (tpipe /simple=39 /head=0,0,3 /output=clip: & copy @clip: foo)
@clip: => C:\CMakeUnitTestBuild\U_\WolfSSL\foo
TCC: (Sys) The filename, directory name, or volume label syntax is incorrect.
 "@clip:"
     0 files copied       1 failed

dir /a:-d /b | (tpipe /simple=39 /head=0,0,3 /output=clip: & do i=1 to 4 (echo %@clip[i%]))
浣歡彥湩瑳污⹬浣歡൥䌊慍敫慃档⹥硴൴戊極摬渮湩慪਍
浣歡彥湩瑳污⹬浣歡൥䌊慍敫慃档⹥硴൴戊極摬渮湩慪਍
浣歡彥湩瑳污⹬浣歡൥䌊慍敫慃档⹥硴൴戊極摬渮湩慪਍
浣歡彥湩瑳污⹬浣歡൥䌊慍敫慃档⹥硴൴戊極摬渮湩慪਍
 
Similar threads
Thread starter Title Forum Replies Date
R @select inside alias gives different (insanely small) window Support 7
Joe Caverly Windows Terminal and @SELECT Support 13
WinLanEm @SELECT problem Support 6
T @select and @selectarray issues Support 2
MikeBaas How to? SELECT: exclude files / display prompt Support 2
rps Documentation "Select" command switch order incorrect Support 4
mikea How to? @select[] window size, redux. Support 3
vefatica IDE double-click select? Support 29
gschizas How to? How can I use select with a folder that already contains parentheses? Support 7
T How to? Select and Delete text Support 6
mikea How to? Understanding @select[] Support 2
vhodro How to? Select text Support 10
WavSlave Fixed Escaping out of SELECT sometimes still executes the command Support 2
B Select and run lines from Command Input panel? Support 1
nikbackm Fixed v15: Issue with @select Support 3
G Fixed v15.00.27: @SELECT Support 10
D ini directives and @select example in Help Support 0
ehab aboudaya How to? Copy to clipboard on select Support 5
Phileosophos SELECT command opens additional tab Support 9
S SELECT DEL (*D.DLL) - output curious Support 8
vefatica Positioning @SELECT[] popup? Support 3
WadeHatler Any way to restore the Text Based "Select File" Windows in TCC Support 2
Stefano Piccardi how to @SELECT redirected input? Support 4
Joe Caverly Error when sorting list alphabetically for @select Support 2
S SELECT - does it support ranges? Support 2
nikbackm @select function and TAB characters Support 1
Joe Caverly @select like 4DOS Support 1
D Can you feed a file list to SELECT? Support 1
A @select versio 10.31 Support 1
nikbackm @select window problem Support 12
vefatica TIMER off by factor of 10 (or even 100) Support 4
I shralias causes svchost.exe to use 100% cpu Support 10
vefatica WAD @RANDOM Support 27
ehab aboudaya Random Register reminder on new tab annoyance Support 4
vefatica Random access to the characters in a string? Support 4

Similar threads