Post by Terry PinnellThanks, I'd love to try it. But can you spell out exactly how I proceed
to do that please?
As mentioned, I have no PowerShell, GAWK or VBS experience. I'm not a
programmer or 'techie'. I see at least three scripts you've taken the
trouble to develop. How do I run them? Let's say on this test folder of
D:\Pictures\Misc-Graphics\Test - Various AR (100)
If you'd like to experiment first, here's my test folder of 10 JPGs,
which includes six with AR's of 16:9.
https://www.dropbox.com/s/3nnyah68iqv2lwt/Test_10for169.zip?raw=1
Terry, East Grinstead, UK
1) Execute control.exe and bring up the Win10 Control Panels.
Find the "Indexing Options".
Make sure D: is included in your index.
Loading Image...
2) Prepare two text files. You can associate the .awk extension
with Notepad if you want. That's how I make it easy to edit.
Editing a Powershell script, sometimes brings up a kind of IDE
for Powershell, which isn't really needed in this case. It's
possible I've associated .ps1 with Notepad too.
skimmer.awk
query.ps1
3) Click the "binaries" link here to get the ZIP with "gawk.exe"
inside it.
http://gnuwin32.sourceforge.net/packages/gawk.htm
gawk-3.1.6-1-bin.zip 1,448,542 bytes
In the bin folder, you'll find "gawk.exe" 352768 bytes.
It's a 32 bit executable.
Move it next to the items in (2).
4) Open a regular Command Prompt. admin isn't needed.
Change directory to where-ever the three files are stored.
In the command itself, you can change the "X:" to the
drive and folder where you want the output placed.
I don't want to make the command too long for an example.
The "cd" command doesn't need quotes on the path spec,
but many other Command Prompt activities do need double
quotes, to isolate paths from one another and pass
properly as tokens to the command.
cd /d C:\users\Terry Pinnell\Downloads\threefiles
gawk -f skimmer.awk 16 9 1 "D:\Pictures\Misc-Graphics\Test - Various AR (100)\\" "X:\outdir" < NUL
The "NUL" on the very end of the command, ensures
that the text input stream to gawk is replaced
by an empty file. This causes gawk to properly
terminate after a run, and the Command Prompt prompt
will come back when it's done.
5) The command has two main phases.
a) Gawk script echoes your parameters, for visual verification later.
b) A powershell task is forked, running an SQL query.
That's the first delay. Temp file is "query.csv".
c) After the delay, the copy phase begins, with some
text output during each file copy. Gawk reads
the "query.csv" file, and does the aspect ratio math.
d) At the end, a progress statement is emitted.
"28616 images in tree, of which 127 got copied"
e) Your curated files are now copied to "X:\outdir"
f) If you run the command again, query.csv is deleted
before powershell is run. This allows query.csv to
sit in the folder, if you want to look at it.
Now, if you look in the working directory,
you'll see a new query.csv file. That lists the
28616 images obtained during (b).
I didn't bother making a logfile, as that's a
"detail" for later. Things in the script that
are "easy", I didn't bother with for an alpha
run. The purpose of the alpha run at the moment,
is to see if this shaves any time off the run or
not (by consulting Windows Search).
In the "query.ps1" file, the width>0 and height>0
are intended to find *all* images in the path.
If you know, as an artist, that no works worth
including will be smaller than 640x480, you
can adjust the parameters in query.ps1 with
a text editor, and make "width>640" and "height>480"
and smaller rubbish images will be ignored. This
will cause the "28616 images" to drop to some
smaller number.
You have on purpose, used a very small tree
for your source tree, so making adjustments
at the moment isn't necessary. The SQL query
delay, will be representative of real usage
cases, and tuning width and height isn't going
to help. It's only if your disk had a million
images on it, the program might scale a bit
better if width and height were restricted
to reasonable artistic values. My disk had some
40x40 images I didn't want included, since
they just clog up the query.csv file for
nothing.
The above process is entirely portable, and nothing
was installed as such, neither were any registry
edits done. Only powershell-related crap might
have causes a state change on your system.
I can't predict ahead of time, what Powershell
"get-executionpolicy" or "set-executionpolicy"
changes might be needed. If you see red-text
spewed by Powershell, it is most likely to be
caused by ExecutionPolicy settings. I did the
best I could, by passing the "Bypass" option
in skimmer.awk, but I cannot guarantee there
will not be surprises on your system. I was
surprised myself by what a damn nuisance Powershell
made for me (the policy was set low enough for
PowerShell to run, yet it would not run).
Good luck,
Paul