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
12,170
133
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,555
26
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
482
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,555
26
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,555
26
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