Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

How to? Select 100 random pictures from 30,000

Jan
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.
 
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.
 
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.
 
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.
 
To avoid the issue of the random choice getting duplicates, you can use TPIPE:
Code:
ffind ...pictures... | tpipe /simple=39 | head /n100 | for f in ( @con: ) copy %f otherfolder\
 
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?
 
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%]))
浣歡彥湩瑳污⹬浣歡൥䌊慍敫慃档⹥硴൴戊極摬渮湩慪਍
浣歡彥湩瑳污⹬浣歡൥䌊慍敫慃档⹥硴൴戊極摬渮湩慪਍
浣歡彥湩瑳污⹬浣歡൥䌊慍敫慃档⹥硴൴戊極摬渮湩慪਍
浣歡彥湩瑳污⹬浣歡൥䌊慍敫慃档⹥硴൴戊極摬渮湩慪਍
 
Simpler:
Code:
v:\> echo foo | tpipe /output=clip:

v:\> echo %@clip[0]
潦൯
 
Back
Top
[FOX] Ultimate Translator
Translate