I could not find shuf in GnuWin32, so I assume it hasn't been not ported to
win (yet?)
Do you have any tip to achieve the same functionality?
What I actually need is to list all files in a folder (find c:\windows) and
provide each item to an executable in random order. I was planning something
like:
find c:\windows | shuf > list.txt
for /f %%G in (list.txt) do (
dosomething with %%G
)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I could not find shuf in GnuWin32, so I assume it hasn't been not ported to
win (yet?)
Do you have any tip to achieve the same functionality?
What I actually need is to list all files in a folder (find c:\windows) and
provide each item to an executable in random order. I was planning something
like:
find c:\windows | shuf > list.txt
for /f %%G in (list.txt) do (
dosomething with %%G
)
You may need to write a simple program yourself using a pseudo-random number
generator or even the `noise.sys' hardware prng driver. The source code of
shuf itself may give you some hints on how to do this, otherwise look at
standard programming references.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Finally I decided to solve the problem by moving everything into a Perl
script. Without using any modules (not even warnings--of course, I'm not
living without it, I just remove it each time after deployment), Perl is still
so powerful, but as portable as copying 1 exe and 2 DLLs (for each arch, if
necessary).
However, thanks a lot for tips!
raysatiro: thanks, it works like a charm! :)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi guys,
I could not find shuf in GnuWin32, so I assume it hasn't been not ported to
win (yet?)
Do you have any tip to achieve the same functionality?
What I actually need is to list all files in a folder (find c:\windows) and
provide each item to an executable in random order. I was planning something
like:
find c:\windows | shuf > list.txt
for /f %%G in (list.txt) do (
dosomething with %%G
)
I could not find shuf in GnuWin32, so I assume it hasn't been not ported to
win (yet?)
Do you have any tip to achieve the same functionality?
What I actually need is to list all files in a folder (find c:\windows) and
provide each item to an executable in random order. I was planning something
like:
find c:\windows | shuf > list.txt
for /f %%G in (list.txt) do (
dosomething with %%G
)
You may need to write a simple program yourself using a pseudo-random number
generator or even the `noise.sys' hardware prng driver. The source code of
shuf itself may give you some hints on how to do this, otherwise look at
standard programming references.
Later versions of sort have a random sort option:
-R, --random-sort sort by random hash of keys
--random-source=FILE get random bytes from FILE
I included a test build of sort-7.6 with the automated gnuwin32 download tool.
You might want to try that.
C:\gnuwin32\bin>find c:\windows | sort-7.6 --random-sort > c:\temp\random-
sorting.txt
https://sourceforge.net/projects/getgnuwin32/
Click the download button
Run GetGnuWin32-0.6.3.exe to extract the files
You do not need to run download.bat if all you want is sort-7.6. It is located
in the GetGnuWin32\bin directory. Copy the exe to wherever you like.
Thank you, guys!
Finally I decided to solve the problem by moving everything into a Perl
script. Without using any modules (not even warnings--of course, I'm not
living without it, I just remove it each time after deployment), Perl is still
so powerful, but as portable as copying 1 exe and 2 DLLs (for each arch, if
necessary).
However, thanks a lot for tips!
raysatiro: thanks, it works like a charm! :)