Discussion:
Sort files by aspect ratio?
(too old to reply)
Terry Pinnell
2018-08-07 11:27:21 UTC
Permalink
Anyone know of a tool or hack that will do something that Win 10 File
Explorer unfortunately cannot: sort a folder of files into aspect ratio
(width/height)?

It's an operation I need quite frequently, such as when trying to
isolate all files with say a 16:9 ratio (to some fine tolerance if
necessary).

Terry, East Grinstead, UK
Keith Nuttle
2018-08-07 13:16:04 UTC
Permalink
Post by Terry Pinnell
Anyone know of a tool or hack that will do something that Win 10 File
Explorer unfortunately cannot: sort a folder of files into aspect ratio
(width/height)?
It's an operation I need quite frequently, such as when trying to
isolate all files with say a 16:9 ratio (to some fine tolerance if
necessary).
Terry, East Grinstead, UK
Could you sort one of the extra columns (right click column Headers) and
sort of height or width?
--
2018: The year we learn to play the great game of Euchre
Terry Pinnell
2018-08-07 16:25:43 UTC
Permalink
Post by Keith Nuttle
Post by Terry Pinnell
Anyone know of a tool or hack that will do something that Win 10 File
Explorer unfortunately cannot: sort a folder of files into aspect ratio
(width/height)?
It's an operation I need quite frequently, such as when trying to
isolate all files with say a 16:9 ratio (to some fine tolerance if
necessary).
Terry, East Grinstead, UK
Could you sort one of the extra columns (right click column Headers) and
sort of height or width?
Thanks but that wouldn't help. An image could have an AR within 1% of
16:9 yet have any of hundreds of possible heights and widths.

Terry, East Grinstead, UK
Bob_S
2018-08-08 01:46:38 UTC
Permalink
Post by Keith Nuttle
Post by Terry Pinnell
Anyone know of a tool or hack that will do something that Win 10 File
Explorer unfortunately cannot: sort a folder of files into aspect ratio
(width/height)?
It's an operation I need quite frequently, such as when trying to
isolate all files with say a 16:9 ratio (to some fine tolerance if
necessary).
Terry, East Grinstead, UK
Could you sort one of the extra columns (right click column Headers) and
sort of height or width?
I'm not seeing the OP's post directly but there is a "Dimension" selection
in Explorer that will sort by height and width. Be sure you are set to view
Details, then right-click on the bar that has the attributes (Name, Type,
Size, etc.) and select "More" in the pop-up window and then scroll down to
"Dimensions" and place a checkmark in it. You can now select the
"Dimension" attribute and it will auto sort by size. May be close enough to
work for what you want.
--
Bob S.
Mayayana
2018-08-08 01:59:59 UTC
Permalink
"Bob_S" <***@phoenix.com> wrote

| I'm not seeing the OP's post directly but there is a "Dimension" selection
| in Explorer that will sort by height and width. Be sure you are set to
view
| Details, then right-click on the bar that has the attributes (Name, Type,
| Size, etc.) and select "More" in the pop-up window and then scroll down to
| "Dimensions" and place a checkmark in it. You can now select the
| "Dimension" attribute and it will auto sort by size. May be close enough
to
| work for what you want.
|

Also note that it sorts alphabetically. So 400x800
will come before 4010x200, which will come before
41x600. Explorer won't sort them in a useful way.
Paul
2018-08-08 03:46:21 UTC
Permalink
Post by Mayayana
| I'm not seeing the OP's post directly but there is a "Dimension" selection
| in Explorer that will sort by height and width. Be sure you are set to
view
| Details, then right-click on the bar that has the attributes (Name, Type,
| Size, etc.) and select "More" in the pop-up window and then scroll down to
| "Dimensions" and place a checkmark in it. You can now select the
| "Dimension" attribute and it will auto sort by size. May be close enough
to
| work for what you want.
|
Also note that it sorts alphabetically. So 400x800
will come before 4010x200, which will come before
41x600. Explorer won't sort them in a useful way.
You can click the Width column and make it sort in order,
then shift-click the head of the Height column, to
make it a secondary selection and sort by its columnar
value second.

Loading Image...

Start with "Detailed" view, then edit the column headers
and add Width as a new column and Height as a new column.

Not that this will save the OP from "years of hard labor".

And after looking at some of the metadata editor
web articles, I'm not at all sure there's an easy way to
do this (for free). It looks like the kind of project
I'd spend three days on it, and give up in frustration.

It's quite possible Terry has multiple metadata types
on disk, and the solution used, would have to deal wth
any of them (EXIF/IPTC/XMP). Cooking up just an EXIF
solution might not be enough.

Paul
Mayayana
2018-08-08 13:44:23 UTC
Permalink
"Paul" <***@needed.invalid> wrote

| It's quite possible Terry has multiple metadata types
| on disk, and the solution used, would have to deal wth
| any of them (EXIF/IPTC/XMP). Cooking up just an EXIF
| solution might not be enough.
|

No. And pulling EXIF data is a sloppy way to go
about it if you have a lot of images. There are
reasonably simple ways to parse the file header.
The trouble is it gets into custom scripting rather
than clicking buttons.

The simplest way is as follows, using an obscure
method available to Windows Script Host. Save this
as a .vbs and drop any BMP, JPG or GIF on it to
get specs:

Dim Pic, Arg, PPI, Ht, Wd

PPI = 96 'for large fonts setting use 120.
Arg = WScript.Arguments(0)
Set Pic = LoadPicture(Arg)
Ht = CInt((PPI * Pic.height) / 2540)
Wd = CInt((PPI * Pic.width) / 2540)
MsgBox Wd & " x " & Ht
Set Pic = Nothing

'-- end script--------------------------------

It's faster and far less work intensive to just
open the file and read in a bit of the header.
That can also be done with PNGs. But the script
code is much more complex. LoadPicture seems
to be actually loading the whole file as a
device-independent bitmap and then using API
to get the specs. Very sloppy internally, but
very simple from the outside. It bypasses the
problem of no EXIF, so it will work on all common
images except PNG/TIF.

But then there are still the steps of walking
the filesystem to find images, calculating the
w/h ratios, deciding on a degree of accuracy,
and finally figuring out a system to be able to
find those files again, such as making a new
folder and copying all 16:9 images into it. None
of that is really difficult, but it's not easy to get
tools to automate it. It's a classic example of
a job suited for scripting.
Terry Pinnell
2018-08-08 20:00:52 UTC
Permalink
Post by Mayayana
| It's quite possible Terry has multiple metadata types
| on disk, and the solution used, would have to deal wth
| any of them (EXIF/IPTC/XMP). Cooking up just an EXIF
| solution might not be enough.
|
No. And pulling EXIF data is a sloppy way to go
about it if you have a lot of images. There are
reasonably simple ways to parse the file header.
The trouble is it gets into custom scripting rather
than clicking buttons.
The simplest way is as follows, using an obscure
method available to Windows Script Host. Save this
as a .vbs and drop any BMP, JPG or GIF on it to
Dim Pic, Arg, PPI, Ht, Wd
PPI = 96 'for large fonts setting use 120.
Arg = WScript.Arguments(0)
Set Pic = LoadPicture(Arg)
Ht = CInt((PPI * Pic.height) / 2540)
Wd = CInt((PPI * Pic.width) / 2540)
MsgBox Wd & " x " & Ht
Set Pic = Nothing
'-- end script--------------------------------
It's faster and far less work intensive to just
open the file and read in a bit of the header.
That can also be done with PNGs. But the script
code is much more complex. LoadPicture seems
to be actually loading the whole file as a
device-independent bitmap and then using API
to get the specs. Very sloppy internally, but
very simple from the outside. It bypasses the
problem of no EXIF, so it will work on all common
images except PNG/TIF.
But then there are still the steps of walking
the filesystem to find images, calculating the
w/h ratios, deciding on a degree of accuracy,
and finally figuring out a system to be able to
find those files again, such as making a new
folder and copying all 16:9 images into it. None
of that is really difficult, but it's not easy to get
tools to automate it. It's a classic example of
a job suited for scripting.
Thanks, will study that asap.

Terry, East Grinstead, UK
Mayayana
2018-08-08 21:39:29 UTC
Permalink
"Terry Pinnell" <***@somewhere.invalid> wrote

| Thanks, will study that asap.
|
If you're interested in working on it you can try this:
(Watch out for wordwrap.) Paste the following into
Notepad, save as a .vbs file. Drop any folder onto it.
You should get a folder created inside with copies of
all images found within 5% of 16/9 ratio that are JPG,
GIF, or BMP. It will also search subfolders.

One one run it didn't pick up a very large image.
I'm not sure if there was a reason for that. If it
turns out to be a problem the script might need
a pause built in for copying big files.

There's not much here for error trapping. You
must drop a valid folder. It also uses the simple
LoadPicture method. Code could be added to
deal with PNGs but that would cost extra. :)


' --- begin script ----------------
Dim FSO, arg, sPath, oFol1, sFol, iCount, iTotalImg, iTotal, sMsg
On Error Resume Next

'--Get folder dropped on script or use InputBox:


sPath = WScript.Arguments(0)
Set FSO = CreateObject("Scripting.FileSystemObject")
If sPath = "" Or FSO.FolderExists(sPath) = False Then WScript.Quit

Set oFol1 = FSO.CreateFolder(sPath & "\16-9")
Set oFol1 = Nothing
sFol = sPath & "\16-9\"
iCount = 0

DoSearch sPath
Set FSO = Nothing

sMsg = iTotalImg & " image files found of " & iTotal & " total files."
sMsg = sMsg & vbCrLf & iCount & " fitting ratio requirements"
sMsg = sMsg & " and copied to " & sFol
MsgBox sMsg

Sub DoSearch(FolPath)
Dim SubPath, Fol, oFol, Fils, oFil, Fols, sExt, LRatio
Set oFol = FSO.GetFolder(FolPath)
Set Fils = oFol.Files
If Fils.count > 0 Then
For Each oFil in Fils
iTotal = iTotal + 1
sExt = UCase(Right(oFil.Name, 4))
If sExt = ".JPG" Or sExt = ".GIF" Or sExt = ".BMP" Then
iTotalImg = iTotalImg + 1
LRatio = GetRat(oFil.Path)
If Len(LRatio) > 0 Then
If FSO.FileExists(sFol & oFil.name) = False Then
FSO.CopyFile oFil.path, sFol & oFil.name, False
iCount = iCount + 1
End If
End If
End If
Next
End If

Set Fols = oFol.SubFolders
If Fols.count > 0 Then
For Each Fol in Fols
SubPath = Fol.Path
DoSearch SubPath
Next
End If
Set Fols = Nothing

Set Fils = Nothing
Set oFol = Nothing

End Sub

Function GetRat(PicPath)
Dim Pic, arg1, PPI, Ht, Wd, Ht9, Wd16
On Error Resume Next
GetRat = ""
PPI = 96 'for large fonts setting use 120.
Set Pic = LoadPicture(PicPath)
Ht = CInt((PPI * Pic.height) / 2540)
Wd = CInt((PPI * Pic.width) / 2540)
Set Pic = Nothing
If Ht > Wd Then Exit Function
Ht9 = Ht / 9
Wd16 = Ht9 * 16
If (Wd16 > (.95 * Wd)) And (Wd16 < (1.05 * Wd)) Then GetRat = PicPath
End Function
Reinhard Skarbal
2018-08-09 09:42:26 UTC
Permalink
Post by Mayayana
Dim FSO, arg, sPath, oFol1, sFol, iCount, iTotalImg, iTotal, sMsg
On Error Resume Next
sPath = WScript.Arguments(0)
Set FSO = CreateObject("Scripting.FileSystemObject")
If sPath = "" Or FSO.FolderExists(sPath) = False Then WScript.Quit
Set oFol1 = FSO.CreateFolder(sPath & "\16-9")
Set oFol1 = Nothing
sFol = sPath & "\16-9\"
iCount = 0
DoSearch sPath
Set FSO = Nothing
sMsg = iTotalImg & " image files found of " & iTotal & " total files."
sMsg = sMsg & vbCrLf & iCount & " fitting ratio requirements"
sMsg = sMsg & " and copied to " & sFol
MsgBox sMsg
Sub DoSearch(FolPath)
Dim SubPath, Fol, oFol, Fils, oFil, Fols, sExt, LRatio
Set oFol = FSO.GetFolder(FolPath)
Set Fils = oFol.Files
If Fils.count > 0 Then
For Each oFil in Fils
iTotal = iTotal + 1
sExt = UCase(Right(oFil.Name, 4))
If sExt = ".JPG" Or sExt = ".GIF" Or sExt = ".BMP" Then
iTotalImg = iTotalImg + 1
LRatio = GetRat(oFil.Path)
If Len(LRatio) > 0 Then
If FSO.FileExists(sFol & oFil.name) = False Then
FSO.CopyFile oFil.path, sFol & oFil.name, False
iCount = iCount + 1
End If
End If
End If
Next
End If
Set Fols = oFol.SubFolders
If Fols.count > 0 Then
For Each Fol in Fols
SubPath = Fol.Path
DoSearch SubPath
Next
Hi mayayana !

How to call your visual basic sript ?
Do I need an additional software for my windows-10 ?

With thanks in advance
Reinhard
Mayayana
2018-08-09 12:51:14 UTC
Permalink
"Reinhard Skarbal" <***@hotmail.com> wrote

| How to call your visual basic sript ?
| Do I need an additional software for my windows-10 ?
|

No, you shouldn't. You just drop a folder
onto it. It uses Windows Script Host, which
has been built in since, I think, Win2000. WSH
(wscript.exe) runs .vbs and .js files by default
and acts as an interpreter for the code. (The
LoadPicture method is actually built into the
WSH, as is CreateObject.) Webpages running
in IE can also run most .vbs script.

It's an intriguing system. With CreateObject,
VBScript can access many system objects
(specifically, and COM object with a Dispatch
interface). That means a script can automate
IE or Word, use ActiveX objects, etc. I've
even written an image editor and scanner utility
using just VBScript in a webpage.

If you have any problems with this script it will
probably be because you accidentally copied a
wordwrapped line from your newsreader. Unlike
javascript, VBS uses line returns to mark the
end of a statement.

The script is safe insofar as it doesn't delete
anything. It just finds BMP/GIF/JPG files
(it will miss ".jpeg" but that can be remedied
if necessary), gets width/height, and if
they're roughly in the right ratio it will copy
them to a newly created subfolder named
"16-9".

There could be complications, though, if one
is running with file restrictions. There's no way
I know of to elevate in a drag/drop operation.
For that the script would need to be written to
accept a typed folder path, so that it could be
right-clicked to run elevated. Restrictions could
be a problem depending on the location you're
dealing with, if you need "permission" to create a
folder and copy files.

If you want to be able to enter the path manually,
you can replace the 5th line of code...

If sPath = "" Or FSO.FolderExists(sPath) = False Then WScript.Quit

....with this:

If sPath = "" Or FSO.FolderExists(sPath) = False Then
sPath = InputBox("Enter full path of folder with images.", "Find 16:9
images")
End If
If sPath = "" Or FSO.FolderExists(sPath) = False Then WScript.Quit

(That's 4 lines. Watch out for wordwrap in your newsreader.)

That will give you the option to drop a folder or
enter the path. I usually code it that way, anyway.
I was just trying to keep this simple, in case Terry
or others want to make their own edits of the script.
In a public script I'd put a lot of error trapping for
"robustness". For instance, I'd write code to check
whether the folder exists before creating it. But this
is meant to be a simple script and it does a simple,
safe operation, so I tried to keep it simple.

You also might want to alter the ratio spec. As written,
it divides the height by 9, multiplies that by 16, then
calls it a match if that number is within 95% and 105%
of the width. If you look at the code you'll see it's easy
to change those numbers, to look for, say, a 6:4 ratio, to
increase or decrease the tolerance range, etc. There
may also be another way to check the ratio. This method
seemed simplest to me, but I didn't research options.
Terry Pinnell
2018-08-09 14:57:06 UTC
Permalink
Post by Mayayana
| Thanks, will study that asap.
|
(Watch out for wordwrap.) Paste the following into
Notepad, save as a .vbs file. Drop any folder onto it.
You should get a folder created inside with copies of
all images found within 5% of 16/9 ratio that are JPG,
GIF, or BMP. It will also search subfolders.
One one run it didn't pick up a very large image.
I'm not sure if there was a reason for that. If it
turns out to be a problem the script might need
a pause built in for copying big files.
There's not much here for error trapping. You
must drop a valid folder. It also uses the simple
LoadPicture method. Code could be added to
deal with PNGs but that would cost extra. :)
' --- begin script ----------------
Dim FSO, arg, sPath, oFol1, sFol, iCount, iTotalImg, iTotal, sMsg
On Error Resume Next
sPath = WScript.Arguments(0)
Set FSO = CreateObject("Scripting.FileSystemObject")
If sPath = "" Or FSO.FolderExists(sPath) = False Then WScript.Quit
Set oFol1 = FSO.CreateFolder(sPath & "\16-9")
Set oFol1 = Nothing
sFol = sPath & "\16-9\"
iCount = 0
DoSearch sPath
Set FSO = Nothing
sMsg = iTotalImg & " image files found of " & iTotal & " total files."
sMsg = sMsg & vbCrLf & iCount & " fitting ratio requirements"
sMsg = sMsg & " and copied to " & sFol
MsgBox sMsg
Sub DoSearch(FolPath)
Dim SubPath, Fol, oFol, Fils, oFil, Fols, sExt, LRatio
Set oFol = FSO.GetFolder(FolPath)
Set Fils = oFol.Files
If Fils.count > 0 Then
For Each oFil in Fils
iTotal = iTotal + 1
sExt = UCase(Right(oFil.Name, 4))
If sExt = ".JPG" Or sExt = ".GIF" Or sExt = ".BMP" Then
iTotalImg = iTotalImg + 1
LRatio = GetRat(oFil.Path)
If Len(LRatio) > 0 Then
If FSO.FileExists(sFol & oFil.name) = False Then
FSO.CopyFile oFil.path, sFol & oFil.name, False
iCount = iCount + 1
End If
End If
End If
Next
End If
Set Fols = oFol.SubFolders
If Fols.count > 0 Then
For Each Fol in Fols
SubPath = Fol.Path
DoSearch SubPath
Next
End If
Set Fols = Nothing
Set Fils = Nothing
Set oFol = Nothing
End Sub
Function GetRat(PicPath)
Dim Pic, arg1, PPI, Ht, Wd, Ht9, Wd16
On Error Resume Next
GetRat = ""
PPI = 96 'for large fonts setting use 120.
Set Pic = LoadPicture(PicPath)
Ht = CInt((PPI * Pic.height) / 2540)
Wd = CInt((PPI * Pic.width) / 2540)
Set Pic = Nothing
If Ht > Wd Then Exit Function
Ht9 = Ht / 9
Wd16 = Ht9 * 16
If (Wd16 > (.95 * Wd)) And (Wd16 < (1.05 * Wd)) Then GetRat = PicPath
End Function
Excellent, that works a treat, many thanks!

I've run it on a couple of test folders (all JPGs) one of a 100 and the
other of 31. I found one minor flaw that should be easy to fix -
although I baulked at attempting it myself ;-) In both cases it reported
the total number of image files too high, the difference being the
number of 169's. iCount is presumably getting included in iTotal and
iTotalImg?

Am I right that I would modify just the line
If (Wd16 > (.95 * Wd)) And (Wd16 < (1.05 * Wd)) Then GetRat = PicPath
to change the percentage tolerance to a lower value than 5%?

And just the previous two lines to test for ARs other than 16:9?

Are there alternative ways to run it apart from dragging the folder onto
the script in FE?

Much appreciate your going to the trouble of writing that.

Terry, East Grinstead, UK
Terry Pinnell
2018-08-09 17:50:31 UTC
Permalink
Post by Terry Pinnell
Excellent, that works a treat, many thanks!
I've run it on a couple of test folders (all JPGs) one of a 100 and the
other of 31. I found one minor flaw that should be easy to fix -
although I baulked at attempting it myself ;-) In both cases it reported
the total number of image files too high, the difference being the
number of 169's. iCount is presumably getting included in iTotal and
iTotalImg?
Am I right that I would modify just the line
If (Wd16 > (.95 * Wd)) And (Wd16 < (1.05 * Wd)) Then GetRat = PicPath
to change the percentage tolerance to a lower value than 5%?
And just the previous two lines to test for ARs other than 16:9?
Are there alternative ways to run it apart from dragging the folder onto
the script in FE?
Much appreciate your going to the trouble of writing that.
Terry, East Grinstead, UK
I've now also written my own with Macro Express Pro, saving ALL files
into a new folder with names prefixed with the AR rounded to 3 dp, like
this:

0.664-20020501-0929021.JPG
1.344-Puglia-047.JPG
1.432-20020330-Janet-Blagdon2.JPG
1.524-Puglia-112.jpg
1.777-Puglia-054.jpg
1.777-Puglia-072.jpg
1.778-Puglia-068.jpg
1.778-Puglia-074.jpg
1.778-Puglia-078.jpg
1.786-Puglia-052.jpg
etc.

But it's glacially slow. I could probably improve it a bit, but it's
currently taking about 5 s per image! In striking contrast your VBS
processed 31 images in 5 s and 100 in 14 s. So although my presentation
method is arguably more useful for my purposes (a quick sort on Name
lets me see and extract ARs like 16:9, 4:3, 3:2, 3:4, etc) it really is
no contest!

Neat work, thanks again.

Terry, East Grinstead, UK
Mayayana
2018-08-09 22:39:54 UTC
Permalink
"Terry Pinnell" <***@somewhere.invalid> wrote

| Excellent, that works a treat, many thanks!
|

Good. It's not alway feasible to make a generic
script that's useful.

| I've run it on a couple of test folders (all JPGs) one of a 100 and the
| other of 31. I found one minor flaw that should be easy to fix -
| although I baulked at attempting it myself ;-) In both cases it reported
| the total number of image files too high, the difference being the
| number of 169's. iCount is presumably getting included in iTotal and
| iTotalImg?
|
Woops. I see what happened. It recurses through
subfolders, so if there are, say, 10 169s in the parent
folder they'll be copied to the 16-9 folder. Then the
recursion will process the 16-9 folder. It's harmless,
but a waste of time and makes for a faulty count.
Here's the fix. Find this section:

Set Fols = oFol.SubFolders
If Fols.count > 0 Then
For Each Fol in Fols
SubPath = Fol.Path
If InStr(SubPath, "16-9") = 0 Then 'new
DoSearch SubPath
End If 'new
Next
End If
Set Fols = Nothing

Replace it with the version above. The two lines
marked with 'new were added to exempt processing
of the 16-9 folder.


| Am I right that I would modify just the line
| If (Wd16 > (.95 * Wd)) And (Wd16 < (1.05 * Wd)) Then GetRat = PicPath
| to change the percentage tolerance to a lower value than 5%?
|

Yes. .98 and 1.02 would give you a 2%
range, for instance. It checking the value of
the actual width against (height / 9) * 16.

| And just the previous two lines to test for ARs other than 16:9?
|

Yes. Change the 16 and 9. You could also make
it multiple: Check whether it's 16:9 or 5:4
or 7:5, etc. Once you've retrieved w/h that extra work
would be negligible.

Also, for anyone who has
trouble, make sure you don't have large fonts set.
I think this is the Registry value to find that setting,
if necessary:

HKEY_CURRENT_USER\Control Panel\Desktop\WindowMetrics\AppliedDPI

It sounds like that's not something that you,
specifically, need to be concerned with.

| Are there alternative ways to run it apart from dragging the folder onto
| the script in FE?
|
FE? See the version I posted for Reinhard. It
provides the option to double-click the .vbs
and enter a path.
There are lots of ways to do it. You could put it
in an HTA to get a GUI. You could hardcode one
or more folder paths... I was just writing something
that's adaptable. You might want to process
G:\ while someone else wants to process their
docs folder and D:\photos. The only way to make
it adaptable is to not hardcode it.
Likewise, you could have it write a list rather
than copying files. The nice thing about script is
that it's easy to customize and it's great for this
kind of automation. But the down side, of course,
is that you have to know how to write it if you
want it customized to your needs.

It could also be quite a bit faster by just reading
the file headers to get width/height. The method I
used is like reading a book to find out a specific fact,
while reading headers is more like looking it up in
the index and reading only the relevant page. But
the method I used is very simple and reasonably
fast for most purposes.

I don'ty know why MEP would be so slow. I guess
it really depends on what steps you're using rather
than on MEP's speed. If you automate something like
picking through EXIF data or have to actually load/display
the image then that will be very inefficient.
Terry Pinnell
2018-08-10 10:38:11 UTC
Permalink
Post by Mayayana
| Excellent, that works a treat, many thanks!
|
Good. It's not alway feasible to make a generic
script that's useful.
| I've run it on a couple of test folders (all JPGs) one of a 100 and the
| other of 31. I found one minor flaw that should be easy to fix -
| although I baulked at attempting it myself ;-) In both cases it reported
| the total number of image files too high, the difference being the
| number of 169's. iCount is presumably getting included in iTotal and
| iTotalImg?
|
Woops. I see what happened. It recurses through
subfolders, so if there are, say, 10 169s in the parent
folder they'll be copied to the 16-9 folder. Then the
recursion will process the 16-9 folder. It's harmless,
but a waste of time and makes for a faulty count.
Set Fols = oFol.SubFolders
If Fols.count > 0 Then
For Each Fol in Fols
SubPath = Fol.Path
If InStr(SubPath, "16-9") = 0 Then 'new
DoSearch SubPath
End If 'new
Next
End If
Set Fols = Nothing
Replace it with the version above. The two lines
marked with 'new were added to exempt processing
of the 16-9 folder.
Thanks a bunch. Duly edited but my 100 images (99 JPGs plus a BMP) are
now reported as 99 out of 100. Correct 169 result.
Post by Mayayana
| Am I right that I would modify just the line
| If (Wd16 > (.95 * Wd)) And (Wd16 < (1.05 * Wd)) Then GetRat = PicPath
| to change the percentage tolerance to a lower value than 5%?
|
Yes. .98 and 1.02 would give you a 2%
range, for instance. It checking the value of
the actual width against (height / 9) * 16.
| And just the previous two lines to test for ARs other than 16:9?
|
Yes. Change the 16 and 9. You could also make
it multiple: Check whether it's 16:9 or 5:4
or 7:5, etc. Once you've retrieved w/h that extra work
would be negligible.
Also, for anyone who has
trouble, make sure you don't have large fonts set.
I think this is the Registry value to find that setting,
HKEY_CURRENT_USER\Control Panel\Desktop\WindowMetrics\AppliedDPI
It sounds like that's not something that you,
specifically, need to be concerned with.
| Are there alternative ways to run it apart from dragging the folder onto
| the script in FE?
|
FE? See the version I posted for Reinhard. It
provides the option to double-click the .vbs
and enter a path.
There are lots of ways to do it. You could put it
in an HTA to get a GUI. You could hardcode one
or more folder paths... I was just writing something
that's adaptable. You might want to process
G:\ while someone else wants to process their
docs folder and D:\photos. The only way to make
it adaptable is to not hardcode it.
Likewise, you could have it write a list rather
than copying files. The nice thing about script is
that it's easy to customize and it's great for this
kind of automation. But the down side, of course,
is that you have to know how to write it if you
want it customized to your needs.
It could also be quite a bit faster by just reading
the file headers to get width/height. The method I
used is like reading a book to find out a specific fact,
while reading headers is more like looking it up in
the index and reading only the relevant page. But
the method I used is very simple and reasonably
fast for most purposes.
I'll experiment.
Post by Mayayana
I don'ty know why MEP would be so slow. I guess
it really depends on what steps you're using rather
than on MEP's speed. If you automate something like
picking through EXIF data or have to actually load/display
the image then that will be very inefficient.
MEP sometimes introduces inexplicably long delays between commands that
should be 'immediate'. But also, of course, merely simulating the steps
I would perform to accomplish is a major factor. In case you missed my
earlier post, here's a paste of how I planned to do it (and which I
implemented):

--------------------
Failing anything simpler (and especially faster), I may do it the
long-winded way with Macro Express Pro:
https://www.dropbox.com/s/tejhxmfa6agxovk/SortByAspect.jpg?raw=1

1. Open file in IrfanView
2. Tap the 'i' key to display its properties
3. Select the 'Current size' field
4. Edit that to get a prefix like '1.333', 1.778, etc. (Need to avoid a
semi-colon. And a decimal value has the advantage of showing me at a
glance if AR is close to a standard. Or I could add that to my macro
after providing a percentage tolerance.)
5. Still in IrfanView, use F2 to change file name, e.g to
'1.333-Pugia-006.jpg' in the example shown.
6. Save that to a new folder.
7. Repeat for all files in the source folder.

A sort on Name with FE in the new folder should then give me what I
need.
--------------------

Note that it currently saves the renamed files to a *fixed* folder for
simplicity, not to a subfolder of the original.

During this entire process I cannot do any other work. The macro is
doing everything that I would do manually, including opening each file
in IrfanView (and displaying it), and its Properties window, etc, etc.
(But no reliance on EXIF, which - even for one of my own photos - might
no longer exist.)

Significant effort might get that 5s per image down to say 3s. No point,
given the much faster methods from your VBS script and (even faster!)
from BeAr's solution.

Terry, East Grinstead, UK
Mayayana
2018-08-10 13:29:24 UTC
Permalink
"Terry Pinnell" <***@somewhere.invalid> wrote

| MEP sometimes introduces inexplicably long delays between commands that
| should be 'immediate'. But also, of course, merely simulating the steps
| I would perform to accomplish is a major factor. In case you missed my
| earlier post, here's a paste of how I planned to do it (and which I
| implemented):
|
| --------------------
| Failing anything simpler (and especially faster), I may do it the
| long-winded way with Macro Express Pro:
| https://www.dropbox.com/s/tejhxmfa6agxovk/SortByAspect.jpg?raw=1
|
| 1. Open file in IrfanView
| 2. Tap the 'i' key to display its properties
| 3. Select the 'Current size' field
| 4. Edit that to get a prefix like '1.333', 1.778, etc. (Need to avoid a
| semi-colon. And a decimal value has the advantage of showing me at a
| glance if AR is close to a standard. Or I could add that to my macro
| after providing a percentage tolerance.)
| 5. Still in IrfanView, use F2 to change file name, e.g to
| '1.333-Pugia-006.jpg' in the example shown.
| 6. Save that to a new folder.
| 7. Repeat for all files in the source folder.
|

Thanks. If you pasted that earlier I missed it. I can
see why it takes so long. For each image you
load IrfanView and display the file, which means not
only parsing the whole file and getting the bitmap,
but also waiting for Windows to paint it onscreen.
Regardless of the JPG size, it's holding a 24-bit-color
bitmap, so of you have an image 4000x3000 that's
going to be 12 million pixels x 3 bytes, or 36 million
bytes, even if the image has been compacted to
a low-res 2 MB. It has to be decompressed. Then
that has to be resized to fit it onscreen, which is
a very work intensive operation. Then Windows
needs to be called to paint it. Then all the editing
steps have to go through several intermediaries.

It's interesting how many ways there can be to
do things. In one case we run next door to borrow
a cup of sugar. In another we call a friend to go get
it. In a third we hire an 18-wheeler to drive to
Cincinatti, get a cup of sugar, and ship it back via
Fedex. But on the surface, the difference is often
not apparent.

A BMP is an especially dramatic example. To get
w/h all you need is to read in the first 26 bytes and
convert two groups of 4 bytes to numbers. That probably
take a couple of milliseconds. Here are the first
26 bytes for a BMP I checked that's 600x400:

42 4D B6 FC 0A 00 00 00 00
00 36 00 00 00 28 00 00 00
58 02 00 00 [width: 600, hex 258]
90 01 00 00 [height: 400, hex 190]

But to use MEP you have to load IrfanView,
with it's libraries. Then IV has to read in the whole
file, parse it, set up the device-independent bitmap,
send that to Windows, and Windows has to paint it.
IV also has to update it's GUI, then MEP has
to use clunky API methods to get the text from
the size field in IV and get the numeric values from
that.

A JPG is similar to a BMP, though slightly more
involved. But it's negligible compared to the amount
of work done by the other methods. My code is calling
the neighbor to get the cup of sugar, and Macro
Express is hiring the 18-wheeler.

I tried out Dimensions2Folders. It looks like someone
wrote exactly the software you want, including GUI
options for variables like ratio. Can't beat that!
Paul
2018-08-08 23:48:02 UTC
Permalink
Post by Terry Pinnell
Thanks, will study that asap.
Terry, East Grinstead, UK
Another thing I discovered, is you can add
"Tags" to a file. This doesn't work for PDF
(for PDF, you need to abuse Alternate Streams
to transport such information). Tags do work
for things with EXIF (JPG, TIFF maybe).

The question would be, how to use it ?

tag:16:9

would find all the files tagged as such by you.
So that's how you'd do a search. But it lacks
the features you wanted, like some tolerance
on the 16:9 ratio, like plus or minus 1% tolerance.
You would have to figure that out in advance.
Or fill the field with 1.79 and search for
1.77 OR 1.78 OR 1.79 to have a tolerance about
the 1.78 median.

Loading Image...

Loading Image...

Generally speaking, "dumping" the fields seems
to be easier than writing to them.

If you do write to "tags", it seems to be semicolon
separated, and your writer program needs to honor
existing tags and just add new tag values onto the end.
Just destroying the tag entry, might not be good
if you've already been using tags. So rather than
being a tag writer, it has to be a tag editor instead.

Apparently you can add "Comments" to a file, which
is probably yet another EXIF field.

Looking in a hex editor, I could see a test string I
used, being in two places. And I couldn't figure out what
that means, in terms of actual storage schemes. The handling
of the header didn't look particularly "hygienic".

Paul
Paul
2018-08-07 14:26:48 UTC
Permalink
Post by Terry Pinnell
Anyone know of a tool or hack that will do something that Win 10 File
Explorer unfortunately cannot: sort a folder of files into aspect ratio
(width/height)?
It's an operation I need quite frequently, such as when trying to
isolate all files with say a 16:9 ratio (to some fine tolerance if
necessary).
Terry, East Grinstead, UK
The third-party examples I could find, seem to
want to "sort" your image collection, into folders,
according to the complex criteria. So instead
of a search as such, they meddle with the collection.

*******

The only thing I can think of, is edit the metadata
on the images, find a field that is searchable
from Windows Search, then write a representative
value into that field in place of the original data.
Then, rebuild the Search Index, to use the new info.

Instead of writing 1.7778 into the field, if the field
was of string type, you could write "16:9" as a text
string.

So maybe in place of Camera, where it says "Nikon",
you could make the Camera "16:9" brand instead :-)

If would be fun if the Search Index was extensible,
but I don't get the impression it's programmable.
And it's limited to a subset of metadata field types.

Maybe it would take some scripting with EXIFTool or
similar. You would want a tool that doesn't mess up
the file system dates as well (which would be an added
complexity).

*******

If you could have, in effect, a File Manager separate
from Windows, with such complex sorting capabilities,
that would be another way to do it.

*******

Running parallel collections is another way to solve it.

You have one collection which is sorted by your standard
folder arrangements.

Then, a second collection is sorted by some criterion,
into folders.

It doubles the storage space.

It takes time to update the "derived" storage tree.

But this is why we have computers.

Paul
nospam
2018-08-07 14:32:52 UTC
Permalink
Post by Paul
Post by Terry Pinnell
Anyone know of a tool or hack that will do something that Win 10 File
Explorer unfortunately cannot: sort a folder of files into aspect ratio
(width/height)?
If you could have, in effect, a File Manager separate
from Windows, with such complex sorting capabilities,
that would be another way to do it.
otherwise known as photo asset manager, such as adobe lightroom:


<https://industrydev.com/wp-content/uploads/2017/01/view-sort-menu-item.
jpg>

<https://photojoseph.com/sites/default/files/sitegraphics/tips/2016/2016-
07-18_14-20-55.jpg>

<https://photojoseph.com/sites/default/files/sitegraphics/tips/2016/2016-
07-18_14-14-56.jpg>
Paul
2018-08-07 15:13:15 UTC
Permalink
Post by nospam
Post by Paul
Post by Terry Pinnell
Anyone know of a tool or hack that will do something that Win 10 File
Explorer unfortunately cannot: sort a folder of files into aspect ratio
(width/height)?
If you could have, in effect, a File Manager separate
from Windows, with such complex sorting capabilities,
that would be another way to do it.
<https://industrydev.com/wp-content/uploads/2017/01/view-sort-menu-item.
jpg>
<https://photojoseph.com/sites/default/files/sitegraphics/tips/2016/2016-
07-18_14-20-55.jpg>
<https://photojoseph.com/sites/default/files/sitegraphics/tips/2016/2016-
07-18_14-14-56.jpg>
Which I assume is free.

Paul
Mayayana
2018-08-07 16:11:08 UTC
Permalink
"Paul" <***@needed.invalid> wrote

| > otherwise known as photo asset manager, such as adobe lightroom:

| Which I assume is free.
|

Yes, once you've delivered your firstborn.
Alternatively, you can pay Adobe "an arm and
a leg" gradually by renting Abode Creative suite
by the month.
nospam
2018-08-07 17:20:12 UTC
Permalink
Post by Mayayana
| Which I assume is free.
|
Yes, once you've delivered your firstborn.
Alternatively, you can pay Adobe "an arm and
a leg" gradually by renting Abode Creative suite
by the month.
where 'arm and a leg' is just $10/mo, less than a large pizza.
Wolf K
2018-08-07 20:53:09 UTC
Permalink
Post by nospam
Post by Mayayana
| Which I assume is free.
|
Yes, once you've delivered your firstborn.
Alternatively, you can pay Adobe "an arm and
a leg" gradually by renting Abode Creative suite
by the month.
where 'arm and a leg' is just $10/mo, less than a large pizza.
Poor example: fast-food pizzas are almost inedible, the frozen things
you get the market are almost as bad, and the good ones from a good
Italian restaurant cost a good deal more than $10.
--
Wolf K
kirkwood40.blogspot.com
Do you know what they call alternative medicine that’s been proven to
work? Medicine. (T. Minchin)
nospam
2018-08-07 21:40:51 UTC
Permalink
Post by Wolf K
Post by nospam
Post by Mayayana
| Which I assume is free.
|
Yes, once you've delivered your firstborn.
Alternatively, you can pay Adobe "an arm and
a leg" gradually by renting Abode Creative suite
by the month.
where 'arm and a leg' is just $10/mo, less than a large pizza.
Poor example: fast-food pizzas are almost inedible, the frozen things
you get the market are almost as bad, and the good ones from a good
Italian restaurant cost a good deal more than $10.
i wasn't referring to any particular pizza seller, but if it's 'a good
deal more than $10' then the point is even stronger.

and the best pizza is usually from a good pizza shop, not an italian
restaurant anyway, especially one that *only* sells pizza.
Mayayana
2018-08-07 22:43:58 UTC
Permalink
"Wolf K" <***@sympatico.ca> wrote

| > where 'arm and a leg' is just $10/mo, less than a large pizza.
| >
|
| Poor example: fast-food pizzas are almost inedible, the frozen things
| you get the market are almost as bad, and the good ones from a good
| Italian restaurant cost a good deal more than $10.
|

And you don't have to pay for them every month
for the forseeable future. $10/month is $480 in
4 years. I paid $50 for Paint Shop Pro 16 about 4
years ago. It's certainly not out of date.
nospam
2018-08-07 23:02:54 UTC
Permalink
Post by Mayayana
| > where 'arm and a leg' is just $10/mo, less than a large pizza.
| >
|
| Poor example: fast-food pizzas are almost inedible, the frozen things
| you get the market are almost as bad, and the good ones from a good
| Italian restaurant cost a good deal more than $10.
And you don't have to pay for them every month
for the forseeable future.
you do if you want pizza every month.

i usually eat pizza more often than once a month, but maybe you don't
like pizza.
Post by Mayayana
$10/month is $480 in
4 years. I paid $50 for Paint Shop Pro 16 about 4
years ago. It's certainly not out of date.
paint shop pro is comparable to photoshop elements, which is usually
around $50-60 street price and a one time purchase.

lightroom is a totally different ballgame.
Wolf K
2018-08-07 16:15:58 UTC
Permalink
Post by Paul
Post by nospam
Post by Paul
Post by Terry Pinnell
Anyone know of a tool or hack that will do something that Win 10 File
Explorer unfortunately cannot: sort a folder of files into aspect ratio
(width/height)?
If you could have, in effect, a File Manager separate
from Windows, with such complex sorting capabilities,
that would be another way to do it.
<https://industrydev.com/wp-content/uploads/2017/01/view-sort-menu-item.
jpg>
<https://photojoseph.com/sites/default/files/sitegraphics/tips/2016/2016-
07-18_14-20-55.jpg>
<https://photojoseph.com/sites/default/files/sitegraphics/tips/2016/2016-
07-18_14-14-56.jpg>
Which I assume is free.
   Paul
Free versions are available from several sources, but on Adobe's own
website it's payware. Unclear exactly what "Lightroom" means in this
context.

Have a good day,
--
Wolf K
kirkwood40.blogspot.com
Do you know what they call alternative medicine that’s been proven to
work? Medicine. (T. Minchin)
nospam
2018-08-07 17:20:12 UTC
Permalink
Post by Wolf K
Post by Paul
Post by nospam
Post by Paul
If you could have, in effect, a File Manager separate
from Windows, with such complex sorting capabilities,
that would be another way to do it.
<https://industrydev.com/wp-content/uploads/2017/01/view-sort-menu-item.
jpg>
<https://photojoseph.com/sites/default/files/sitegraphics/tips/2016/2016-
07-18_14-20-55.jpg>
<https://photojoseph.com/sites/default/files/sitegraphics/tips/2016/2016-
07-18_14-14-56.jpg>
Which I assume is free.
   Paul
Free versions are available from several sources, but on Adobe's own
website it's payware. Unclear exactly what "Lightroom" means in this
context.
what's unclear?

lightroom is the name of adobe's photo asset manager:
<https://www.adobe.com/products/photoshop-lightroom.html>
Wolf K
2018-08-07 20:50:32 UTC
Permalink
Post by nospam
Post by Wolf K
Post by Paul
Post by nospam
Post by Paul
If you could have, in effect, a File Manager separate
from Windows, with such complex sorting capabilities,
that would be another way to do it.
<https://industrydev.com/wp-content/uploads/2017/01/view-sort-menu-item.
jpg>
<https://photojoseph.com/sites/default/files/sitegraphics/tips/2016/2016-
07-18_14-20-55.jpg>
<https://photojoseph.com/sites/default/files/sitegraphics/tips/2016/2016-
07-18_14-14-56.jpg>
Which I assume is free.
   Paul
Free versions are available from several sources, but on Adobe's own
website it's payware. Unclear exactly what "Lightroom" means in this
context.
what's unclear?
<https://www.adobe.com/products/photoshop-lightroom.html>
And this:

https://adobe-photoshop-lightroom.en.softonic.com/

Have a good day,
--
Wolf K
kirkwood40.blogspot.com
Do you know what they call alternative medicine that’s been proven to
work? Medicine. (T. Minchin)
nospam
2018-08-07 21:40:51 UTC
Permalink
Post by Wolf K
Post by nospam
Post by Wolf K
Free versions are available from several sources, but on Adobe's own
website it's payware. Unclear exactly what "Lightroom" means in this
context.
what's unclear?
<https://www.adobe.com/products/photoshop-lightroom.html>
https://adobe-photoshop-lightroom.en.softonic.com/
no, definitely *not* that.

seriously, wtf!

*always* download from the developer's own site, or alternately, from
the app store for the relevant platform.

*never* download from another source unless you are *absolutely* sure
it's genuine and can confirm it, ideally with a hash.

otherwise, there is a very significant risk getting an unexpected and
undesirable bonus, aka malware, adware, etc., especially if the source
claims something is free when the real thing is not.

softonic in particular is to be *avoided*:

<https://blog.malwarebytes.com/detections/pup-optional-softonic/>
Short bio
PUP.Optional.Softonic is Malwarebytes¹ generic detection name for the
Softonic Downloader, an adware-supported bundler targeting Windows
systems.

Type and source of infection
PUP.Optional.Softonic uses manipulative UI options to prompt users to
install further adware that is difficult to uninstall. Softonic had
previously included a toolbar with their download that required admin
privileges, and changed the user¹s home page to softonic.com. Some
software previously included by Softonic have been considered
actively malicious.

Softonic Downloader is found on Softonic affiliated downloads at
en.softonic.com.

<https://www.microsoft.com/en-us/wdsi/threats/malware-encyclopedia-descr
iption?Name=PUA:Win32/Softonic>
PUA:Win32/Softonic
...
These applications are most commonly software bundlers or installers
for applications such as toolbars, adware, or system optimizers.

If you were trying to install an application, you might have
downloaded it from a source other than the official product's website.
nospam
2018-08-07 17:20:11 UTC
Permalink
Post by Paul
Post by nospam
Post by Paul
Post by Terry Pinnell
Anyone know of a tool or hack that will do something that Win 10 File
Explorer unfortunately cannot: sort a folder of files into aspect ratio
(width/height)?
If you could have, in effect, a File Manager separate
from Windows, with such complex sorting capabilities,
that would be another way to do it.
<https://industrydev.com/wp-content/uploads/2017/01/view-sort-menu-item.
jpg>
<https://photojoseph.com/sites/default/files/sitegraphics/tips/2016/2016-
07-18_14-20-55.jpg>
<https://photojoseph.com/sites/default/files/sitegraphics/tips/2016/2016-
07-18_14-14-56.jpg>
Which I assume is free.
lightroom is not free.
Terry Pinnell
2018-08-07 16:26:51 UTC
Permalink
Post by nospam
Post by Paul
Post by Terry Pinnell
Anyone know of a tool or hack that will do something that Win 10 File
Explorer unfortunately cannot: sort a folder of files into aspect ratio
(width/height)?
If you could have, in effect, a File Manager separate
from Windows, with such complex sorting capabilities,
that would be another way to do it.
<https://industrydev.com/wp-content/uploads/2017/01/view-sort-menu-item.
jpg>
<https://photojoseph.com/sites/default/files/sitegraphics/tips/2016/2016-
07-18_14-20-55.jpg>
<https://photojoseph.com/sites/default/files/sitegraphics/tips/2016/2016-
07-18_14-14-56.jpg>
Thanks, but that's a lot heavier than what I had in mind!

Terry, East Grinstead, UK
Terry Pinnell
2018-08-07 16:23:22 UTC
Permalink
Post by Paul
Post by Terry Pinnell
Anyone know of a tool or hack that will do something that Win 10 File
Explorer unfortunately cannot: sort a folder of files into aspect ratio
(width/height)?
It's an operation I need quite frequently, such as when trying to
isolate all files with say a 16:9 ratio (to some fine tolerance if
necessary).
Terry, East Grinstead, UK
The third-party examples I could find, seem to
want to "sort" your image collection, into folders,
according to the complex criteria. So instead
of a search as such, they meddle with the collection.
*******
The only thing I can think of, is edit the metadata
on the images, find a field that is searchable
from Windows Search, then write a representative
value into that field in place of the original data.
Then, rebuild the Search Index, to use the new info.
Instead of writing 1.7778 into the field, if the field
was of string type, you could write "16:9" as a text
string.
So maybe in place of Camera, where it says "Nikon",
you could make the Camera "16:9" brand instead :-)
If would be fun if the Search Index was extensible,
but I don't get the impression it's programmable.
And it's limited to a subset of metadata field types.
Maybe it would take some scripting with EXIFTool or
similar. You would want a tool that doesn't mess up
the file system dates as well (which would be an added
complexity).
*******
If you could have, in effect, a File Manager separate
from Windows, with such complex sorting capabilities,
that would be another way to do it.
*******
Running parallel collections is another way to solve it.
You have one collection which is sorted by your standard
folder arrangements.
Then, a second collection is sorted by some criterion,
into folders.
It doubles the storage space.
It takes time to update the "derived" storage tree.
But this is why we have computers.
Paul
Failing anything simpler (and especially faster), I may do it the
long-winded way with Macro Express Pro:
Loading Image...

1. Open file in IrfanView
2. Tap the 'i' key to display its properties
3. Select the 'Current size' field
4. Edit that to get a prefix like '1.333', 1.778, etc. (Need to avoid a
semi-colon. And a decimal value has the advantage of showing me at a
glance if AR is close to a standard. Or I could add that to my macro
after providing a percentage tolerance.)
5. Still in IrfanView, use F2 to change file name, e.g to
'1.333-Pugia-006.jpg' in the example shown.
6. Save that to a new folder.
7. Repeat for all files in the source folder.

A sort on Name with FE in the new folder should then give me what I
need.

Given all the obscure column options (I reckon there are 350 or so), the
absence of AR seems a major oversight.

Terry, East Grinstead, UK
Reinhard Skarbal
2018-08-07 21:14:53 UTC
Permalink
Post by Paul
Post by Terry Pinnell
Anyone know of a tool or hack that will do something that Win 10 File
Explorer unfortunately cannot: sort a folder of files into aspect ratio
(width/height)?
It's an operation I need quite frequently, such as when trying to
isolate all files with say a 16:9 ratio (to some fine tolerance if
necessary).
Terry, East Grinstead, UK
The third-party examples I could find, seem to
want to "sort" your image collection, into folders,
according to the complex criteria. So instead
of a search as such, they meddle with the collection.
*******
The only thing I can think of, is edit the metadata
on the images, find a field that is searchable
from Windows Search, then write a representative
value into that field in place of the original data.
Then, rebuild the Search Index, to use the new info.
Instead of writing 1.7778 into the field, if the field
was of string type, you could write "16:9" as a text
string.
So maybe in place of Camera, where it says "Nikon",
you could make the Camera "16:9" brand instead :-)
If would be fun if the Search Index was extensible,
but I don't get the impression it's programmable.
And it's limited to a subset of metadata field types.
Maybe it would take some scripting with EXIFTool or
similar. You would want a tool that doesn't mess up
the file system dates as well (which would be an added
complexity).
*******
If you could have, in effect, a File Manager separate
from Windows, with such complex sorting capabilities,
that would be another way to do it.
*******
Running parallel collections is another way to solve it.
Hi Terry

For Windows 10 :
Writing a little script in awk which is using EXIFTOOL will do the job.
This script will create a batch-file for moving (or copying) all
pictures of an certain witdth/height (+- n %) into a new folder.

If you like I will write this script for you in a few days for nothing.
Just send me an email.

Regards
Reinhard

***@aon.at
Terry Pinnell
2018-08-08 18:46:41 UTC
Permalink
Post by Reinhard Skarbal
Post by Paul
Post by Terry Pinnell
Anyone know of a tool or hack that will do something that Win 10 File
Explorer unfortunately cannot: sort a folder of files into aspect ratio
(width/height)?
It's an operation I need quite frequently, such as when trying to
isolate all files with say a 16:9 ratio (to some fine tolerance if
necessary).
Terry, East Grinstead, UK
The third-party examples I could find, seem to
want to "sort" your image collection, into folders,
according to the complex criteria. So instead
of a search as such, they meddle with the collection.
*******
The only thing I can think of, is edit the metadata
on the images, find a field that is searchable
from Windows Search, then write a representative
value into that field in place of the original data.
Then, rebuild the Search Index, to use the new info.
Instead of writing 1.7778 into the field, if the field
was of string type, you could write "16:9" as a text
string.
So maybe in place of Camera, where it says "Nikon",
you could make the Camera "16:9" brand instead :-)
If would be fun if the Search Index was extensible,
but I don't get the impression it's programmable.
And it's limited to a subset of metadata field types.
Maybe it would take some scripting with EXIFTool or
similar. You would want a tool that doesn't mess up
the file system dates as well (which would be an added
complexity).
*******
If you could have, in effect, a File Manager separate
from Windows, with such complex sorting capabilities,
that would be another way to do it.
*******
Running parallel collections is another way to solve it.
Hi Terry
Writing a little script in awk which is using EXIFTOOL will do the job.
This script will create a batch-file for moving (or copying) all
pictures of an certain witdth/height (+- n %) into a new folder.
If you like I will write this script for you in a few days for nothing.
Just send me an email.
Regards
Reinhard
Hi Reinhard,

Thanks, that's very generous of you. Is an awk script simple to run
under Windows? Perhaps we could test that first if you have a basic
script at hand? Something at the 'Hello World' level, with no-brainer
instructions on how to run it?

Did you see my 'macro outline' up-thread?

Terry, East Grinstead, UK
Paul
2018-08-09 00:06:04 UTC
Permalink
Post by Terry Pinnell
Post by Reinhard Skarbal
Post by Paul
Post by Terry Pinnell
Anyone know of a tool or hack that will do something that Win 10 File
Explorer unfortunately cannot: sort a folder of files into aspect ratio
(width/height)?
It's an operation I need quite frequently, such as when trying to
isolate all files with say a 16:9 ratio (to some fine tolerance if
necessary).
Terry, East Grinstead, UK
The third-party examples I could find, seem to
want to "sort" your image collection, into folders,
according to the complex criteria. So instead
of a search as such, they meddle with the collection.
*******
The only thing I can think of, is edit the metadata
on the images, find a field that is searchable
from Windows Search, then write a representative
value into that field in place of the original data.
Then, rebuild the Search Index, to use the new info.
Instead of writing 1.7778 into the field, if the field
was of string type, you could write "16:9" as a text
string.
So maybe in place of Camera, where it says "Nikon",
you could make the Camera "16:9" brand instead :-)
If would be fun if the Search Index was extensible,
but I don't get the impression it's programmable.
And it's limited to a subset of metadata field types.
Maybe it would take some scripting with EXIFTool or
similar. You would want a tool that doesn't mess up
the file system dates as well (which would be an added
complexity).
*******
If you could have, in effect, a File Manager separate
from Windows, with such complex sorting capabilities,
that would be another way to do it.
*******
Running parallel collections is another way to solve it.
Hi Terry
Writing a little script in awk which is using EXIFTOOL will do the job.
This script will create a batch-file for moving (or copying) all
pictures of an certain witdth/height (+- n %) into a new folder.
If you like I will write this script for you in a few days for nothing.
Just send me an email.
Regards
Reinhard
Hi Reinhard,
Thanks, that's very generous of you. Is an awk script simple to run
under Windows? Perhaps we could test that first if you have a basic
script at hand? Something at the 'Hello World' level, with no-brainer
instructions on how to run it?
Did you see my 'macro outline' up-thread?
Terry, East Grinstead, UK
Windows 10 has Bash shell. It has gawk. Gawk
is a version of AWK, with some slight differences.
(There were AWK, NAWK, and GAWK as variants).

Using a script for batch work, might look like this.
I've rigged up the .awk extension, to open in Notepad here.

gawk -f myscript.awk input.txt > output.txt

If you download the "Documentation" link here, it
contains a very nice PDF manual for the language.
This manual is every bit as good as the "gray manual"
by the original inventors.

http://gnuwin32.sourceforge.net/packages/gawk.htm

... gawk-3.1.6-1-doc.zip\doc\gawk\3.1.6\gawk-3.1.6\gawk.pdf

The gnuwin32 page has Gawk 3, whereas the Windows 10
Bash shell has Gawk 4. The Bash shell version "puts the wrong
line endings on stuff", and there's a two-line stanza
for the BEGIN clause, to "make it behave nicer".
Bottom line is, if using the Win10 Bash Gawk4,
test carefully and patch up the problem you find.
The gnuwin32 was ported specifically to offer
a taste of the software to Windows users, so
the line endings work out better for you.

The Gawk 3 is very good, quality wise. But one
day when I was processing a 20GB text file, Gawk 3
crashed just before producing output, and the script
I was running then ran fine in Gawk 4. That might
be an example of when to reach for the Bash shell
version.

Paul
Terry Pinnell
2018-08-09 13:35:47 UTC
Permalink
Post by Paul
Post by Terry Pinnell
Post by Reinhard Skarbal
Post by Paul
Post by Terry Pinnell
Anyone know of a tool or hack that will do something that Win 10 File
Explorer unfortunately cannot: sort a folder of files into aspect ratio
(width/height)?
It's an operation I need quite frequently, such as when trying to
isolate all files with say a 16:9 ratio (to some fine tolerance if
necessary).
Terry, East Grinstead, UK
The third-party examples I could find, seem to
want to "sort" your image collection, into folders,
according to the complex criteria. So instead
of a search as such, they meddle with the collection.
*******
The only thing I can think of, is edit the metadata
on the images, find a field that is searchable
from Windows Search, then write a representative
value into that field in place of the original data.
Then, rebuild the Search Index, to use the new info.
Instead of writing 1.7778 into the field, if the field
was of string type, you could write "16:9" as a text
string.
So maybe in place of Camera, where it says "Nikon",
you could make the Camera "16:9" brand instead :-)
If would be fun if the Search Index was extensible,
but I don't get the impression it's programmable.
And it's limited to a subset of metadata field types.
Maybe it would take some scripting with EXIFTool or
similar. You would want a tool that doesn't mess up
the file system dates as well (which would be an added
complexity).
*******
If you could have, in effect, a File Manager separate
from Windows, with such complex sorting capabilities,
that would be another way to do it.
*******
Running parallel collections is another way to solve it.
Hi Terry
Writing a little script in awk which is using EXIFTOOL will do the job.
This script will create a batch-file for moving (or copying) all
pictures of an certain witdth/height (+- n %) into a new folder.
If you like I will write this script for you in a few days for nothing.
Just send me an email.
Regards
Reinhard
Hi Reinhard,
Thanks, that's very generous of you. Is an awk script simple to run
under Windows? Perhaps we could test that first if you have a basic
script at hand? Something at the 'Hello World' level, with no-brainer
instructions on how to run it?
Did you see my 'macro outline' up-thread?
Terry, East Grinstead, UK
Windows 10 has Bash shell. It has gawk. Gawk
is a version of AWK, with some slight differences.
(There were AWK, NAWK, and GAWK as variants).
Using a script for batch work, might look like this.
I've rigged up the .awk extension, to open in Notepad here.
gawk -f myscript.awk input.txt > output.txt
If you download the "Documentation" link here, it
contains a very nice PDF manual for the language.
This manual is every bit as good as the "gray manual"
by the original inventors.
http://gnuwin32.sourceforge.net/packages/gawk.htm
... gawk-3.1.6-1-doc.zip\doc\gawk\3.1.6\gawk-3.1.6\gawk.pdf
The gnuwin32 page has Gawk 3, whereas the Windows 10
Bash shell has Gawk 4. The Bash shell version "puts the wrong
line endings on stuff", and there's a two-line stanza
for the BEGIN clause, to "make it behave nicer".
Bottom line is, if using the Win10 Bash Gawk4,
test carefully and patch up the problem you find.
The gnuwin32 was ported specifically to offer
a taste of the software to Windows users, so
the line endings work out better for you.
The Gawk 3 is very good, quality wise. But one
day when I was processing a 20GB text file, Gawk 3
crashed just before producing output, and the script
I was running then ran fine in Gawk 4. That might
be an example of when to reach for the Bash shell
version.
Paul
Thanks, very helpful. With AWK/GAWK in mind I may well have to abandon
my recent resolution ("Resist learning new stuff and focus on creative
work with the stuff I know") as AWK/GAWK/NAWK looks rather useful.

But I'm always cheerful about building on others' know-how in copy/paste
mode. Which is what I'm about to do by trying both Mayayana's and
Reinhard's respective VBS and AWK scripts.

Still always more satisfying to do it myself though, so I'm still
looking at my macro approach ;-)

Terry, East Grinstead, UK
Mayayana
2018-08-07 14:59:13 UTC
Permalink
"Terry Pinnell" <***@somewhere.invalid> wrote

| Anyone know of a tool or hack that will do something that Win 10 File
| Explorer unfortunately cannot: sort a folder of files into aspect ratio
| (width/height)?
|
| It's an operation I need quite frequently, such as when trying to
| isolate all files with say a 16:9 ratio (to some fine tolerance if
| necessary).
|
You're talking about image w/h dimensions? Even on
XP I can choose to show "Dimensions" in detail view.
But that still won't sort the images. And it doesn't
calculate w/h ratio.

I doubt many people want that, either, so it's not
likely to exist as software.

It would be relatively simple to do with scripting,
as far as finding w/h and sorting the file list, but
then you'd still have the problem of how to display them.
It sounds like what you want is an Explorer substitute.
It might be easier to just sort and/or resize them by
folder.
Terry Pinnell
2018-08-07 16:28:04 UTC
Permalink
Post by Mayayana
| Anyone know of a tool or hack that will do something that Win 10 File
| Explorer unfortunately cannot: sort a folder of files into aspect ratio
| (width/height)?
|
| It's an operation I need quite frequently, such as when trying to
| isolate all files with say a 16:9 ratio (to some fine tolerance if
| necessary).
|
You're talking about image w/h dimensions? Even on
XP I can choose to show "Dimensions" in detail view.
But that still won't sort the images. And it doesn't
calculate w/h ratio.
I doubt many people want that, either, so it's not
likely to exist as software.
It would be relatively simple to do with scripting,
as far as finding w/h and sorting the file list, but
then you'd still have the problem of how to display them.
It sounds like what you want is an Explorer substitute.
It might be easier to just sort and/or resize them by
folder.
Thanks, yes, I'll probably have to take the scripting approach, as per
my reply to Paul.

Terry, East Grinstead, UK
VanguardLH
2018-08-07 22:37:57 UTC
Permalink
Post by Terry Pinnell
Anyone know of a tool or hack that will do something that Win 10 File
Explorer unfortunately cannot: sort a folder of files into aspect ratio
(width/height)?
It's an operation I need quite frequently, such as when trying to
isolate all files with say a 16:9 ratio (to some fine tolerance if
necessary).
In XnView, I can sort by image size, image width, image height, and a
bunch of other attributes.

For images (photos), I can see how such attributes would be known
without having to render the image. I'm not sure the same would work
for video files. I'd have to find out if that info was available BEFORE
the codec gets used to decode the content. The metadata might be there
(but not for all video formats) but some of it could be blank, and
having to play a video to ensure getting its valid aspect ratio would
take way too long to interrogate to then sort. I'm no video wizard and
there are other newsgroups more into video where the community there
would know more about what is in the video file (other than just
metadata which could me absent, blank, or incorrect) to know if its
aspect ratio could be determine without have to engage the codec to
decode. In VLC, I can go to Tools -> Codec to see the video dimensions
but that's after VLC has already started using the codec to play the
video.

So, no, not in Windows/File Explorer do I know a way to sort by width,
height, or the combo of the two as an aspect ratio (16:9 would be 1.77)
but other image tools appear to have the feature. I doubt XnView would
be the only image manager/viewer to have those sort selections. If
XnView has it then I would suspect Irfanview to have it, too. Instead
of using Windows/File Explorer to manage your image collections, you use
a tool that was actually geared to handle and manage images. There are
many uses for a flat-blade screwdriver but it's not really a good choice
for jamming into a torx screw head.
Zaidy036
2018-08-08 01:05:46 UTC
Permalink
Post by Terry Pinnell
Anyone know of a tool or hack that will do something that Win 10 File
Explorer unfortunately cannot: sort a folder of files into aspect ratio
(width/height)?
It's an operation I need quite frequently, such as when trying to
isolate all files with say a 16:9 ratio (to some fine tolerance if
necessary).
Terry, East Grinstead, UK
How about using BR's EXIFextracter and Excel?
<http://www.br-software.com/extracter.html>
--
Zaidy036
Terry Pinnell
2018-08-08 18:24:12 UTC
Permalink
Post by Zaidy036
Post by Terry Pinnell
Anyone know of a tool or hack that will do something that Win 10 File
Explorer unfortunately cannot: sort a folder of files into aspect ratio
(width/height)?
It's an operation I need quite frequently, such as when trying to
isolate all files with say a 16:9 ratio (to some fine tolerance if
necessary).
Terry, East Grinstead, UK
How about using BR's EXIFextracter and Excel?
<http://www.br-software.com/extracter.html>
1. Not all images have EXIF data
2. EXIF data does not include AR.

Terry, East Grinstead, UK
B. R. 'BeAr' Ederson
2018-08-08 05:14:09 UTC
Permalink
Post by Terry Pinnell
Anyone know of a tool or hack that will do something that Win 10 File
Explorer unfortunately cannot: sort a folder of files into aspect ratio
(width/height)?
It's an operation I need quite frequently, such as when trying to
isolate all files with say a 16:9 ratio (to some fine tolerance if
necessary).
Maybe you use Dimension2Folder by Jody Holmes to sort the images into
different (sub)folders and do whatever you want to do with them, there.
Later on, you can recombine the images into one directory.

http://www.dcmembers.com/skwire/download/dimensions-2-folders

F-Up set to acf.
BeAr
--
===========================================================================
= What do you mean with: "Perfection is always an illusion"? =
===============================================================--(Oops!)===
Terry Pinnell
2018-08-08 18:25:46 UTC
Permalink
Post by B. R. 'BeAr' Ederson
Post by Terry Pinnell
Anyone know of a tool or hack that will do something that Win 10 File
Explorer unfortunately cannot: sort a folder of files into aspect ratio
(width/height)?
It's an operation I need quite frequently, such as when trying to
isolate all files with say a 16:9 ratio (to some fine tolerance if
necessary).
Maybe you use Dimension2Folder by Jody Holmes to sort the images into
different (sub)folders and do whatever you want to do with them, there.
Later on, you can recombine the images into one directory.
http://www.dcmembers.com/skwire/download/dimensions-2-folders
F-Up set to acf.
BeAr
Thanks, but any tool that (like FE) does not have access directly to AR
requires just as much additional work as using FE.

Terry, East Grinstead, UK
B. R. 'BeAr' Ederson
2018-08-08 18:38:55 UTC
Permalink
On Wed, 08 Aug 2018 19:25:46 +0100, Terry Pinnell wrote:

[Dimension2Folder]
Post by Terry Pinnell
Thanks, but any tool that (like FE) does not have access directly to AR
requires just as much additional work as using FE.
I don't understand, what you're referring to. Dimension2Folder lets you
directly choose aspect ratio (even with tolerance if you like). If you
bunch-move those images to a dedicated folder, you can either work with
them or all remaining images. Afterwards you can move them back together
and are done.

BeAr
--
===========================================================================
= What do you mean with: "Perfection is always an illusion"? =
===============================================================--(Oops!)===
Terry Pinnell
2018-08-09 22:13:07 UTC
Permalink
Post by B. R. 'BeAr' Ederson
[Dimension2Folder]
Post by Terry Pinnell
Thanks, but any tool that (like FE) does not have access directly to AR
requires just as much additional work as using FE.
I don't understand, what you're referring to. Dimension2Folder lets you
directly choose aspect ratio (even with tolerance if you like). If you
bunch-move those images to a dedicated folder, you can either work with
them or all remaining images. Afterwards you can move them back together
and are done.
BeAr
You're right, my test yesterday was hasty. See my subsequent post a few
minutes ago; Dimension2Folder is the best solution so far, thanks!

Terry, East Grinstead, UK
B. R. 'BeAr' Ederson
2018-08-09 19:51:43 UTC
Permalink
Post by Terry Pinnell
Anyone know of a tool or hack that will do something that Win 10 File
Explorer unfortunately cannot: sort a folder of files into aspect ratio
(width/height)?
Although I still think, Dimensions2Folder is best suited for your needs,

http://www.dcmembers.com/skwire/download/dimensions-2-folders

maybe you like Arti from the same author even better:

http://www.dcmembers.com/skwire/download/arti

Be sure to (really) try both of them. They are no-install portable.

F-Up set to acf.
BeAr
--
===========================================================================
= What do you mean with: "Perfection is always an illusion"? =
===============================================================--(Oops!)===
Terry Pinnell
2018-08-09 22:07:52 UTC
Permalink
Post by B. R. 'BeAr' Ederson
Post by Terry Pinnell
Anyone know of a tool or hack that will do something that Win 10 File
Explorer unfortunately cannot: sort a folder of files into aspect ratio
(width/height)?
Although I still think, Dimensions2Folder is best suited for your needs,
http://www.dcmembers.com/skwire/download/dimensions-2-folders
http://www.dcmembers.com/skwire/download/arti
Be sure to (really) try both of them. They are no-install portable.
F-Up set to acf.
BeAr
Thanks BeAr, Dimensions2Folder is a nice tool and it does indeed do what
I want. And on brief acquaintance it has the advantage of being over
three times faster than Mayayana's VBS script. For example, my test
folder of 100 files took 4 s.

Did you try Arti? It appears to be unstable here in Version 1803 (build
17134.167). A few seconds after dragging a folder or multiple files, it
closes unceremoniously.

Terry, East Grinstead, UK
Paul
2018-08-10 02:21:11 UTC
Permalink
Post by Terry Pinnell
Post by B. R. 'BeAr' Ederson
Post by Terry Pinnell
Anyone know of a tool or hack that will do something that Win 10 File
Explorer unfortunately cannot: sort a folder of files into aspect ratio
(width/height)?
Although I still think, Dimensions2Folder is best suited for your needs,
http://www.dcmembers.com/skwire/download/dimensions-2-folders
http://www.dcmembers.com/skwire/download/arti
Be sure to (really) try both of them. They are no-install portable.
F-Up set to acf.
BeAr
Thanks BeAr, Dimensions2Folder is a nice tool and it does indeed do what
I want. And on brief acquaintance it has the advantage of being over
three times faster than Mayayana's VBS script. For example, my test
folder of 100 files took 4 s.
Did you try Arti? It appears to be unstable here in Version 1803 (build
17134.167). A few seconds after dragging a folder or multiple files, it
closes unceremoniously.
Terry, East Grinstead, UK
A faster way to get the picture information, would be
to consult Windows.edb instead.

This is a tech demo, not a complete application.
It generates a CSV file which shows all the
images on the path in the SCOPE. Adjust the SCOPE
string to reflect where your image collection is on
disk. If you set the scope to "C:\" then you'll
pick up every 1x1 pixel picture ever invented :-)

What this is doing, is leveraging the three hours spent
by the Windows Search indexer, on your image collection
already.

Yes, you've seen this script before, in a previous
question. I just tweaked it a little bit. You run this
from a "regular user" Powershell. cd to the directory
containing the script, then run it. Powershell will not
run a file from the current working directory, unless
the dot is in front, as shown. I'm not a Powershell
expert, so am not going to be able to dig you out
of trouble all that easily. I'm a "copy/paste expert" :-/
If I can do it with copy/paste, I will.

########### ./little_bobby_tables2.ps1 ################################
#
# Inspiration: https://www.petri.com/how-to-query-the-windows-search-index-using-sql-and-powershell
#
# (Commented out text, is either outright failed stuff, or variants you can test)
#
# At the bottom line, pick a more imaginative filename...
#
# Hint - the less formatting you do in PowerShell, the faster the script runs.
#
# The CSV can be pulled into Excel, LibreOffice Calc, or Notepad.
#
######################################################################

$sql = "SELECT System.ItemFolderPathDisplay, `
System.ItemName, `
System.Image.HorizontalSize, `
System.Image.VerticalSize FROM SYSTEMINDEX `
WHERE System.Image.HorizontalSize>0 AND `
System.Image.VerticalSize>0 AND `
SCOPE='C:\users\Terry Pinnell\Downloads'"

$provider = "provider=search.collatordso;extended properties=’application=windows’;"

$connector = new-object system.data.oledb.oledbdataadapter -argument $sql, $provider

$dataset = new-object system.data.dataset

if ($connector.fill($dataset)) { $dataset.tables[0] | Export-CSV little.bobby.tables.4.csv }

########### end of ./little_bobby_tables2.ps1 ##########################

Paul
Terry Pinnell
2018-08-10 11:04:40 UTC
Permalink
Post by Paul
Post by Terry Pinnell
Post by B. R. 'BeAr' Ederson
Post by Terry Pinnell
Anyone know of a tool or hack that will do something that Win 10 File
Explorer unfortunately cannot: sort a folder of files into aspect ratio
(width/height)?
Although I still think, Dimensions2Folder is best suited for your needs,
http://www.dcmembers.com/skwire/download/dimensions-2-folders
http://www.dcmembers.com/skwire/download/arti
Be sure to (really) try both of them. They are no-install portable.
F-Up set to acf.
BeAr
Thanks BeAr, Dimensions2Folder is a nice tool and it does indeed do what
I want. And on brief acquaintance it has the advantage of being over
three times faster than Mayayana's VBS script. For example, my test
folder of 100 files took 4 s.
Did you try Arti? It appears to be unstable here in Version 1803 (build
17134.167). A few seconds after dragging a folder or multiple files, it
closes unceremoniously.
Terry, East Grinstead, UK
A faster way to get the picture information, would be
to consult Windows.edb instead.
This is a tech demo, not a complete application.
It generates a CSV file which shows all the
images on the path in the SCOPE. Adjust the SCOPE
string to reflect where your image collection is on
disk. If you set the scope to "C:\" then you'll
pick up every 1x1 pixel picture ever invented :-)
What this is doing, is leveraging the three hours spent
by the Windows Search indexer, on your image collection
already.
Yes, you've seen this script before, in a previous
question. I just tweaked it a little bit. You run this
from a "regular user" Powershell. cd to the directory
containing the script, then run it. Powershell will not
run a file from the current working directory, unless
the dot is in front, as shown. I'm not a Powershell
expert, so am not going to be able to dig you out
of trouble all that easily. I'm a "copy/paste expert" :-/
If I can do it with copy/paste, I will.
########### ./little_bobby_tables2.ps1 ################################
#
# Inspiration: https://www.petri.com/how-to-query-the-windows-search-index-using-sql-and-powershell
#
# (Commented out text, is either outright failed stuff, or variants you can test)
#
# At the bottom line, pick a more imaginative filename...
#
# Hint - the less formatting you do in PowerShell, the faster the script runs.
#
# The CSV can be pulled into Excel, LibreOffice Calc, or Notepad.
#
######################################################################
$sql = "SELECT System.ItemFolderPathDisplay, `
System.ItemName, `
System.Image.HorizontalSize, `
System.Image.VerticalSize FROM SYSTEMINDEX `
WHERE System.Image.HorizontalSize>0 AND `
System.Image.VerticalSize>0 AND `
SCOPE='C:\users\Terry Pinnell\Downloads'"
$provider = "provider=search.collatordso;extended properties=Â’application=windowsÂ’;"
$connector = new-object system.data.oledb.oledbdataadapter -argument $sql, $provider
$dataset = new-object system.data.dataset
if ($connector.fill($dataset)) { $dataset.tables[0] | Export-CSV little.bobby.tables.4.csv }
########### end of ./little_bobby_tables2.ps1 ##########################
Paul
Thanks, but I'm having trouble at the first hurdle. Haven't enough time
right now to plunge into learning the basics of Powershell. But as a
start I copy pasted your entire text to my editor and saved it in
C:\Users\terry\Dropbox\Scripts as
./little_bobby_tables2.ps1
(I assumed that's a lower case letter 'l', not the number '1'? But I've
tried both. Neither look like legitimate filenames...

I opened a PS window. What should I now type on the command line to run
that script file? Or how should I rename it?

Terry, East Grinstead, UK
Paul
2018-08-10 11:24:03 UTC
Permalink
Post by Terry Pinnell
Post by Paul
Post by Terry Pinnell
Post by B. R. 'BeAr' Ederson
Post by Terry Pinnell
Anyone know of a tool or hack that will do something that Win 10 File
Explorer unfortunately cannot: sort a folder of files into aspect ratio
(width/height)?
Although I still think, Dimensions2Folder is best suited for your needs,
http://www.dcmembers.com/skwire/download/dimensions-2-folders
http://www.dcmembers.com/skwire/download/arti
Be sure to (really) try both of them. They are no-install portable.
F-Up set to acf.
BeAr
Thanks BeAr, Dimensions2Folder is a nice tool and it does indeed do what
I want. And on brief acquaintance it has the advantage of being over
three times faster than Mayayana's VBS script. For example, my test
folder of 100 files took 4 s.
Did you try Arti? It appears to be unstable here in Version 1803 (build
17134.167). A few seconds after dragging a folder or multiple files, it
closes unceremoniously.
Terry, East Grinstead, UK
A faster way to get the picture information, would be
to consult Windows.edb instead.
This is a tech demo, not a complete application.
It generates a CSV file which shows all the
images on the path in the SCOPE. Adjust the SCOPE
string to reflect where your image collection is on
disk. If you set the scope to "C:\" then you'll
pick up every 1x1 pixel picture ever invented :-)
What this is doing, is leveraging the three hours spent
by the Windows Search indexer, on your image collection
already.
Yes, you've seen this script before, in a previous
question. I just tweaked it a little bit. You run this
from a "regular user" Powershell. cd to the directory
containing the script, then run it. Powershell will not
run a file from the current working directory, unless
the dot is in front, as shown. I'm not a Powershell
expert, so am not going to be able to dig you out
of trouble all that easily. I'm a "copy/paste expert" :-/
If I can do it with copy/paste, I will.
########### ./little_bobby_tables2.ps1 ################################
#
# Inspiration: https://www.petri.com/how-to-query-the-windows-search-index-using-sql-and-powershell
#
# (Commented out text, is either outright failed stuff, or variants you can test)
#
# At the bottom line, pick a more imaginative filename...
#
# Hint - the less formatting you do in PowerShell, the faster the script runs.
#
# The CSV can be pulled into Excel, LibreOffice Calc, or Notepad.
#
######################################################################
$sql = "SELECT System.ItemFolderPathDisplay, `
System.ItemName, `
System.Image.HorizontalSize, `
System.Image.VerticalSize FROM SYSTEMINDEX `
WHERE System.Image.HorizontalSize>0 AND `
System.Image.VerticalSize>0 AND `
SCOPE='C:\users\Terry Pinnell\Downloads'"
$provider = "provider=search.collatordso;extended properties=’application=windows’;"
$connector = new-object system.data.oledb.oledbdataadapter -argument $sql, $provider
$dataset = new-object system.data.dataset
if ($connector.fill($dataset)) { $dataset.tables[0] | Export-CSV little.bobby.tables.4.csv }
########### end of ./little_bobby_tables2.ps1 ##########################
Paul
Thanks, but I'm having trouble at the first hurdle. Haven't enough time
right now to plunge into learning the basics of Powershell. But as a
start I copy pasted your entire text to my editor and saved it in
C:\Users\terry\Dropbox\Scripts as
./little_bobby_tables2.ps1
(I assumed that's a lower case letter 'l', not the number '1'? But I've
tried both. Neither look like legitimate filenames...
I opened a PS window. What should I now type on the command line to run
that script file? Or how should I rename it?
Terry, East Grinstead, UK
You can rename it to "powertst.ps1" if you want.
That's Pee Esse One as a file extension.

I didn't invent that extension. Microsoft did.

1) Open a Powershell window.

2) .\powertst.ps1

Then open the output file that's been dumped
into the same directory. You could change the
name in the script from "little.bobby.tables.4.csv"
if you want. You could use "powertst.csv" if you
wanted, to make the name shorter.

Paul
Terry Pinnell
2018-08-11 15:58:51 UTC
Permalink
Post by Paul
Post by Terry Pinnell
Post by Paul
Post by Terry Pinnell
Post by B. R. 'BeAr' Ederson
Post by Terry Pinnell
Anyone know of a tool or hack that will do something that Win 10 File
Explorer unfortunately cannot: sort a folder of files into aspect ratio
(width/height)?
Although I still think, Dimensions2Folder is best suited for your needs,
http://www.dcmembers.com/skwire/download/dimensions-2-folders
http://www.dcmembers.com/skwire/download/arti
Be sure to (really) try both of them. They are no-install portable.
F-Up set to acf.
BeAr
Thanks BeAr, Dimensions2Folder is a nice tool and it does indeed do what
I want. And on brief acquaintance it has the advantage of being over
three times faster than Mayayana's VBS script. For example, my test
folder of 100 files took 4 s.
Did you try Arti? It appears to be unstable here in Version 1803 (build
17134.167). A few seconds after dragging a folder or multiple files, it
closes unceremoniously.
Terry, East Grinstead, UK
A faster way to get the picture information, would be
to consult Windows.edb instead.
This is a tech demo, not a complete application.
It generates a CSV file which shows all the
images on the path in the SCOPE. Adjust the SCOPE
string to reflect where your image collection is on
disk. If you set the scope to "C:\" then you'll
pick up every 1x1 pixel picture ever invented :-)
What this is doing, is leveraging the three hours spent
by the Windows Search indexer, on your image collection
already.
Yes, you've seen this script before, in a previous
question. I just tweaked it a little bit. You run this
from a "regular user" Powershell. cd to the directory
containing the script, then run it. Powershell will not
run a file from the current working directory, unless
the dot is in front, as shown. I'm not a Powershell
expert, so am not going to be able to dig you out
of trouble all that easily. I'm a "copy/paste expert" :-/
If I can do it with copy/paste, I will.
########### ./little_bobby_tables2.ps1 ################################
#
# Inspiration: https://www.petri.com/how-to-query-the-windows-search-index-using-sql-and-powershell
#
# (Commented out text, is either outright failed stuff, or variants you can test)
#
# At the bottom line, pick a more imaginative filename...
#
# Hint - the less formatting you do in PowerShell, the faster the script runs.
#
# The CSV can be pulled into Excel, LibreOffice Calc, or Notepad.
#
######################################################################
$sql = "SELECT System.ItemFolderPathDisplay, `
System.ItemName, `
System.Image.HorizontalSize, `
System.Image.VerticalSize FROM SYSTEMINDEX `
WHERE System.Image.HorizontalSize>0 AND `
System.Image.VerticalSize>0 AND `
SCOPE='C:\users\Terry Pinnell\Downloads'"
$provider = "provider=search.collatordso;extended properties=Â’application=windowsÂ’;"
$connector = new-object system.data.oledb.oledbdataadapter -argument $sql, $provider
$dataset = new-object system.data.dataset
if ($connector.fill($dataset)) { $dataset.tables[0] | Export-CSV little.bobby.tables.4.csv }
########### end of ./little_bobby_tables2.ps1 ##########################
Paul
Thanks, but I'm having trouble at the first hurdle. Haven't enough time
right now to plunge into learning the basics of Powershell. But as a
start I copy pasted your entire text to my editor and saved it in
C:\Users\terry\Dropbox\Scripts as
./little_bobby_tables2.ps1
(I assumed that's a lower case letter 'l', not the number '1'? But I've
tried both. Neither look like legitimate filenames...
I opened a PS window. What should I now type on the command line to run
that script file? Or how should I rename it?
Terry, East Grinstead, UK
You can rename it to "powertst.ps1" if you want.
That's Pee Esse One as a file extension.
I didn't invent that extension. Microsoft did.
1) Open a Powershell window.
2) .\powertst.ps1
Then open the output file that's been dumped
into the same directory. You could change the
name in the script from "little.bobby.tables.4.csv"
if you want. You could use "powertst.csv" if you
wanted, to make the name shorter.
Paul
A very useful learning exercise, thanks. I now know how to run a
copy/pasted PS1 script. But not a practical route to a solution, as it
delivers only a CSV file, not a folder of selected or renamed files.

BeAr's recommended solution, Dimensions2Folders, is the one I've started
using. But it will also be interesting to see the AWK/GAWK script
Reinhard is developing.

Terry, East Grinstead, UK
Paul
2018-08-11 16:52:55 UTC
Permalink
Post by Terry Pinnell
A very useful learning exercise, thanks. I now know how to run a
copy/pasted PS1 script. But not a practical route to a solution, as it
delivers only a CSV file, not a folder of selected or renamed files.
BeAr's recommended solution, Dimensions2Folders, is the one I've started
using. But it will also be interesting to see the AWK/GAWK script
Reinhard is developing.
Terry, East Grinstead, UK
What you were supposed to learn from the exercise, is
you can "scan" the entire C: in a couple of seconds
and get a CSV with all the image sizes.

Now, feed the CSV into some other scripting language.

This is intended to reduce the initial scan time,
not the curated copy time.

The fun part, would be seeing if gawk can fork a
powershell subshell to run that script.

The file copy time would be a fixed overhead for
all participants and their code. You can't make
that part go faster. There are some optimizations
you could attempt, but they would be expensive
in programming time, and non-scalable. If your
tree of things to copy was too large, maybe
an optimization wouldn't work right. If you have
an optimization in time, it should work properly
no matter what the total quantity of files is,
to be considered a "win". (For example, using
a RAMDisk to hold a temporary copy, would be defeated
if the file set was larger than the RAMDisk. As
an example of an attempt at an optimization.)

*******

The only purpose of showing you that demo, is
to demonstrate that the three hours you waited
for Search Indexer to keep Windows.edb up to
date wasn't wasted. For any image format that
defined a Width and Height, you can tap into
Windows.edb and get the information. Instead
of "walking" the file tree and doing it
manually. The Search Indexer also keeps the
index up to date (mostly) in real time. It's
not like doing a scan of the file tree has
an advantage of giving the most advanced
view of the tree. Search Indexer is working
on that, constantly.

If you dump a million files onto C: and then
run that script, well obviously, the indexing
won't be done by then. This concept is
mainly intended for "stable data silos"
where the content you're searching against,
is collected a little bit at a time. Then
later you want to search your corpus of
work and find just the right item. If you're
tossing crap onto a scratch disk, then wanting
to search the scratch disk, one of the other
programs would work better for that.

Paul
Paul
2018-08-11 23:59:32 UTC
Permalink
Post by Terry Pinnell
Post by Paul
Post by Terry Pinnell
Post by Paul
Post by Terry Pinnell
Post by B. R. 'BeAr' Ederson
Post by Terry Pinnell
Anyone know of a tool or hack that will do something that Win 10 File
Explorer unfortunately cannot: sort a folder of files into aspect ratio
(width/height)?
Although I still think, Dimensions2Folder is best suited for your needs,
http://www.dcmembers.com/skwire/download/dimensions-2-folders
http://www.dcmembers.com/skwire/download/arti
Be sure to (really) try both of them. They are no-install portable.
F-Up set to acf.
BeAr
Thanks BeAr, Dimensions2Folder is a nice tool and it does indeed do what
I want. And on brief acquaintance it has the advantage of being over
three times faster than Mayayana's VBS script. For example, my test
folder of 100 files took 4 s.
Did you try Arti? It appears to be unstable here in Version 1803 (build
17134.167). A few seconds after dragging a folder or multiple files, it
closes unceremoniously.
Terry, East Grinstead, UK
A faster way to get the picture information, would be
to consult Windows.edb instead.
This is a tech demo, not a complete application.
It generates a CSV file which shows all the
images on the path in the SCOPE. Adjust the SCOPE
string to reflect where your image collection is on
disk. If you set the scope to "C:\" then you'll
pick up every 1x1 pixel picture ever invented :-)
What this is doing, is leveraging the three hours spent
by the Windows Search indexer, on your image collection
already.
Yes, you've seen this script before, in a previous
question. I just tweaked it a little bit. You run this
from a "regular user" Powershell. cd to the directory
containing the script, then run it. Powershell will not
run a file from the current working directory, unless
the dot is in front, as shown. I'm not a Powershell
expert, so am not going to be able to dig you out
of trouble all that easily. I'm a "copy/paste expert" :-/
If I can do it with copy/paste, I will.
########### ./little_bobby_tables2.ps1 ################################
#
# Inspiration: https://www.petri.com/how-to-query-the-windows-search-index-using-sql-and-powershell
#
# (Commented out text, is either outright failed stuff, or variants you can test)
#
# At the bottom line, pick a more imaginative filename...
#
# Hint - the less formatting you do in PowerShell, the faster the script runs.
#
# The CSV can be pulled into Excel, LibreOffice Calc, or Notepad.
#
######################################################################
$sql = "SELECT System.ItemFolderPathDisplay, `
System.ItemName, `
System.Image.HorizontalSize, `
System.Image.VerticalSize FROM SYSTEMINDEX `
WHERE System.Image.HorizontalSize>0 AND `
System.Image.VerticalSize>0 AND `
SCOPE='C:\users\Terry Pinnell\Downloads'"
$provider = "provider=search.collatordso;extended properties=’application=windows’;"
$connector = new-object system.data.oledb.oledbdataadapter -argument $sql, $provider
$dataset = new-object system.data.dataset
if ($connector.fill($dataset)) { $dataset.tables[0] | Export-CSV little.bobby.tables.4.csv }
########### end of ./little_bobby_tables2.ps1 ##########################
Paul
Thanks, but I'm having trouble at the first hurdle. Haven't enough time
right now to plunge into learning the basics of Powershell. But as a
start I copy pasted your entire text to my editor and saved it in
C:\Users\terry\Dropbox\Scripts as
./little_bobby_tables2.ps1
(I assumed that's a lower case letter 'l', not the number '1'? But I've
tried both. Neither look like legitimate filenames...
I opened a PS window. What should I now type on the command line to run
that script file? Or how should I rename it?
Terry, East Grinstead, UK
You can rename it to "powertst.ps1" if you want.
That's Pee Esse One as a file extension.
I didn't invent that extension. Microsoft did.
1) Open a Powershell window.
2) .\powertst.ps1
Then open the output file that's been dumped
into the same directory. You could change the
name in the script from "little.bobby.tables.4.csv"
if you want. You could use "powertst.csv" if you
wanted, to make the name shorter.
Paul
A very useful learning exercise, thanks. I now know how to run a
copy/pasted PS1 script. But not a practical route to a solution, as it
delivers only a CSV file, not a folder of selected or renamed files.
BeAr's recommended solution, Dimensions2Folders, is the one I've started
using. But it will also be interesting to see the AWK/GAWK script
Reinhard is developing.
Terry, East Grinstead, UK
Here's my project.
Two files.
The awk file uses Gawk 3.

The binaries link from this page, has the executable.

http://gnuwin32.sourceforge.net/packages/gawk.htm

Gawk calls powershell, to do the database query.
Powershell has a set-executionpolicy, which would
normally be set to "UnRestricted" for home usage.

I had trouble calling Powershell, using the normal technique.
However, to my shock and horror, the shell allows override
being passed to it directly.

powershell -executionpolicy bypass -file query.ps1

It's only running as a regular user, so there's no "elevation
attack" so far by doing this. In any case, mines running :-/

**************** Helper script "query.ps1" ********************
# powershell -file query.ps1 -TREEDIR "'C:\'"

param([string]$TREEDIR="'C:\'")

$sql = "SELECT System.ItemFolderPathDisplay, `
System.ItemName, `
System.Image.HorizontalSize, `
System.Image.VerticalSize FROM SYSTEMINDEX `
WHERE System.Image.HorizontalSize>0 AND `
System.Image.VerticalSize>0 AND `
SCOPE=$TREEDIR"

$provider = "provider=search.collatordso;extended properties=’application=windows’;"
$connector = new-object system.data.oledb.oledbdataadapter -argument $sql, $provider
$dataset = new-object system.data.dataset
if ($connector.fill($dataset)) { $dataset.tables[0] | Export-CSV query.csv }
**************** end of Helper script "query.ps1" **************

**************** "skimmer.awk" ********************
# gawk -f skimmer.awk width height percent scan_path out_dir
#
# gawk -f skimmer.awk 16 9 1 "C:\\" "C:\users\user name\downloads\outdir" < NUL
#
# 0 1 2 3 4 5 (no input file)
#
# ARGC = 6 ARGV[0] .. ARGV[5]
#
# query.csv looks like this, skip the first two lines. There can be commas in the filename!
#
# #TYPE System.Data.DataRow
# "SYSTEM.ITEMFOLDERPATHDISPLAY","SYSTEM.ITEMNAME","SYSTEM.IMAGE.HORIZONTALSIZE","SYSTEM.IMAGE.VERTICALSIZE"
# "C:\Users\user name\Downloads\JPG2","0000014994_1.jpg","669","600"
# "C:\Users\user name\Downloads\JPG2","04.jpg","500","375"
#
###########################################################################
# This is a first cut script, with no error handling or disaster proofing!
# No warranty expressed or implied. Paul.

BEGIN {
if (ARGC != 6) {
print "Usage: width height percent_tol source_tree destdir"
print "gawk -f skimmer.awk 16 9 1 " "\"C:\\\\\" " "\"C:\\users\\user name\\downloads\\outdir\" < NUL"
print ""

print "The program needs five arguments."
print "In some cases, two backslashes may be required on the end of a path, to work."
print "This proof print will then show one backslash as having made it through."
print ""
for (i = 1; i < ARGC; i++) print ARGV[i]
exit 0
} else {
print "Called with"
print ""
for (i = 1; i < ARGC; i++) print ARGV[i]
print ""
width = ARGV[1]+0
height = ARGV[2]+0
percent = ARGV[3]+0
outdir = ARGV[5]
}

# houseclean before run - no collision protection, run one copy only!

cmd = "\"del query.csv\""
system( cmd )

cmd = "\"powershell -executionpolicy bypass -file query.ps1 -TREEDIR \"'" ARGV[4] "'\"\""
print "Query: " cmd
print ""
system( cmd )

# You can redirect stderr ("2") output to clean the output a bit.
# Here, I'm hiding the warning that the directory already exists.

cmd = "\"md \"" outdir "\" 2>NUL\""
print "Cmd: " cmd
print ""
system( cmd )

high = width/height * (1 + percent/100)
low = width/height * (1 - percent/100)

if ( (high < 0) || (low < 0) ) exit 0

i=0
j=0

# No FPAT in Gawk3

FS="\""
while ( (getline < "query.csv") > 0 ) {
if ( i >= 2 ) {

# "C:\Users\xxxx yyyyyyy\Downloads\JPG2","04.jpg","500","375"
# 2 3 4 5 6 7 8
aspect = $6/$8
if ( (high >= aspect) && (low <= aspect) ) {
print $4 " = " $6 " " $8
cmd = "\"copy \"" $2 "\\" $4 "\" \"" outdir "\"\""
print "Cmd: " cmd
system( cmd )
j++
}
}
i++
}
print i " images in tree, of which " j " got copied"
close( "query.csv" )
# The following jazz not required now, as the program has no other clauses
delete ARGV[5]
delete ARGV[4]
delete ARGV[3]
delete ARGV[2]
delete ARGV[1]
}

#END {
# print "Processed " i " lines"
#}
************* end of "skimmer.awk" ****************

HTH,
Paul
Terry Pinnell
2018-08-12 17:28:02 UTC
Permalink
Post by Paul
Post by Terry Pinnell
Post by Paul
Post by Terry Pinnell
Post by Paul
Post by Terry Pinnell
Post by B. R. 'BeAr' Ederson
Post by Terry Pinnell
Anyone know of a tool or hack that will do something that Win 10 File
Explorer unfortunately cannot: sort a folder of files into aspect ratio
(width/height)?
Although I still think, Dimensions2Folder is best suited for your needs,
http://www.dcmembers.com/skwire/download/dimensions-2-folders
http://www.dcmembers.com/skwire/download/arti
Be sure to (really) try both of them. They are no-install portable.
F-Up set to acf.
BeAr
Thanks BeAr, Dimensions2Folder is a nice tool and it does indeed do what
I want. And on brief acquaintance it has the advantage of being over
three times faster than Mayayana's VBS script. For example, my test
folder of 100 files took 4 s.
Did you try Arti? It appears to be unstable here in Version 1803 (build
17134.167). A few seconds after dragging a folder or multiple files, it
closes unceremoniously.
Terry, East Grinstead, UK
A faster way to get the picture information, would be
to consult Windows.edb instead.
This is a tech demo, not a complete application.
It generates a CSV file which shows all the
images on the path in the SCOPE. Adjust the SCOPE
string to reflect where your image collection is on
disk. If you set the scope to "C:\" then you'll
pick up every 1x1 pixel picture ever invented :-)
What this is doing, is leveraging the three hours spent
by the Windows Search indexer, on your image collection
already.
Yes, you've seen this script before, in a previous
question. I just tweaked it a little bit. You run this
from a "regular user" Powershell. cd to the directory
containing the script, then run it. Powershell will not
run a file from the current working directory, unless
the dot is in front, as shown. I'm not a Powershell
expert, so am not going to be able to dig you out
of trouble all that easily. I'm a "copy/paste expert" :-/
If I can do it with copy/paste, I will.
########### ./little_bobby_tables2.ps1 ################################
#
# Inspiration: https://www.petri.com/how-to-query-the-windows-search-index-using-sql-and-powershell
#
# (Commented out text, is either outright failed stuff, or variants you can test)
#
# At the bottom line, pick a more imaginative filename...
#
# Hint - the less formatting you do in PowerShell, the faster the script runs.
#
# The CSV can be pulled into Excel, LibreOffice Calc, or Notepad.
#
######################################################################
$sql = "SELECT System.ItemFolderPathDisplay, `
System.ItemName, `
System.Image.HorizontalSize, `
System.Image.VerticalSize FROM SYSTEMINDEX `
WHERE System.Image.HorizontalSize>0 AND `
System.Image.VerticalSize>0 AND `
SCOPE='C:\users\Terry Pinnell\Downloads'"
$provider = "provider=search.collatordso;extended properties=Â’application=windowsÂ’;"
$connector = new-object system.data.oledb.oledbdataadapter -argument $sql, $provider
$dataset = new-object system.data.dataset
if ($connector.fill($dataset)) { $dataset.tables[0] | Export-CSV little.bobby.tables.4.csv }
########### end of ./little_bobby_tables2.ps1 ##########################
Paul
Thanks, but I'm having trouble at the first hurdle. Haven't enough time
right now to plunge into learning the basics of Powershell. But as a
start I copy pasted your entire text to my editor and saved it in
C:\Users\terry\Dropbox\Scripts as
./little_bobby_tables2.ps1
(I assumed that's a lower case letter 'l', not the number '1'? But I've
tried both. Neither look like legitimate filenames...
I opened a PS window. What should I now type on the command line to run
that script file? Or how should I rename it?
Terry, East Grinstead, UK
You can rename it to "powertst.ps1" if you want.
That's Pee Esse One as a file extension.
I didn't invent that extension. Microsoft did.
1) Open a Powershell window.
2) .\powertst.ps1
Then open the output file that's been dumped
into the same directory. You could change the
name in the script from "little.bobby.tables.4.csv"
if you want. You could use "powertst.csv" if you
wanted, to make the name shorter.
Paul
A very useful learning exercise, thanks. I now know how to run a
copy/pasted PS1 script. But not a practical route to a solution, as it
delivers only a CSV file, not a folder of selected or renamed files.
BeAr's recommended solution, Dimensions2Folders, is the one I've started
using. But it will also be interesting to see the AWK/GAWK script
Reinhard is developing.
Terry, East Grinstead, UK
Here's my project.
Two files.
The awk file uses Gawk 3.
The binaries link from this page, has the executable.
http://gnuwin32.sourceforge.net/packages/gawk.htm
Gawk calls powershell, to do the database query.
Powershell has a set-executionpolicy, which would
normally be set to "UnRestricted" for home usage.
I had trouble calling Powershell, using the normal technique.
However, to my shock and horror, the shell allows override
being passed to it directly.
powershell -executionpolicy bypass -file query.ps1
It's only running as a regular user, so there's no "elevation
attack" so far by doing this. In any case, mines running :-/
**************** Helper script "query.ps1" ********************
# powershell -file query.ps1 -TREEDIR "'C:\'"
param([string]$TREEDIR="'C:\'")
$sql = "SELECT System.ItemFolderPathDisplay, `
System.ItemName, `
System.Image.HorizontalSize, `
System.Image.VerticalSize FROM SYSTEMINDEX `
WHERE System.Image.HorizontalSize>0 AND `
System.Image.VerticalSize>0 AND `
SCOPE=$TREEDIR"
$provider = "provider=search.collatordso;extended properties=Â’application=windowsÂ’;"
$connector = new-object system.data.oledb.oledbdataadapter -argument $sql, $provider
$dataset = new-object system.data.dataset
if ($connector.fill($dataset)) { $dataset.tables[0] | Export-CSV query.csv }
**************** end of Helper script "query.ps1" **************
**************** "skimmer.awk" ********************
# gawk -f skimmer.awk width height percent scan_path out_dir
#
# gawk -f skimmer.awk 16 9 1 "C:\\" "C:\users\user name\downloads\outdir" < NUL
#
# 0 1 2 3 4 5 (no input file)
#
# ARGC = 6 ARGV[0] .. ARGV[5]
#
# query.csv looks like this, skip the first two lines. There can be commas in the filename!
#
# #TYPE System.Data.DataRow
# "SYSTEM.ITEMFOLDERPATHDISPLAY","SYSTEM.ITEMNAME","SYSTEM.IMAGE.HORIZONTALSIZE","SYSTEM.IMAGE.VERTICALSIZE"
# "C:\Users\user name\Downloads\JPG2","0000014994_1.jpg","669","600"
# "C:\Users\user name\Downloads\JPG2","04.jpg","500","375"
#
###########################################################################
# This is a first cut script, with no error handling or disaster proofing!
# No warranty expressed or implied. Paul.
BEGIN {
if (ARGC != 6) {
print "Usage: width height percent_tol source_tree destdir"
print "gawk -f skimmer.awk 16 9 1 " "\"C:\\\\\" " "\"C:\\users\\user name\\downloads\\outdir\" < NUL"
print ""
print "The program needs five arguments."
print "In some cases, two backslashes may be required on the end of a path, to work."
print "This proof print will then show one backslash as having made it through."
print ""
for (i = 1; i < ARGC; i++) print ARGV[i]
exit 0
} else {
print "Called with"
print ""
for (i = 1; i < ARGC; i++) print ARGV[i]
print ""
width = ARGV[1]+0
height = ARGV[2]+0
percent = ARGV[3]+0
outdir = ARGV[5]
}
# houseclean before run - no collision protection, run one copy only!
cmd = "\"del query.csv\""
system( cmd )
cmd = "\"powershell -executionpolicy bypass -file query.ps1 -TREEDIR \"'" ARGV[4] "'\"\""
print "Query: " cmd
print ""
system( cmd )
# You can redirect stderr ("2") output to clean the output a bit.
# Here, I'm hiding the warning that the directory already exists.
cmd = "\"md \"" outdir "\" 2>NUL\""
print "Cmd: " cmd
print ""
system( cmd )
high = width/height * (1 + percent/100)
low = width/height * (1 - percent/100)
if ( (high < 0) || (low < 0) ) exit 0
i=0
j=0
# No FPAT in Gawk3
FS="\""
while ( (getline < "query.csv") > 0 ) {
if ( i >= 2 ) {
# "C:\Users\xxxx yyyyyyy\Downloads\JPG2","04.jpg","500","375"
# 2 3 4 5 6 7 8
aspect = $6/$8
if ( (high >= aspect) && (low <= aspect) ) {
print $4 " = " $6 " " $8
cmd = "\"copy \"" $2 "\\" $4 "\" \"" outdir "\"\""
print "Cmd: " cmd
system( cmd )
j++
}
}
i++
}
print i " images in tree, of which " j " got copied"
close( "query.csv" )
# The following jazz not required now, as the program has no other clauses
delete ARGV[5]
delete ARGV[4]
delete ARGV[3]
delete ARGV[2]
delete ARGV[1]
}
#END {
# print "Processed " i " lines"
#}
************* end of "skimmer.awk" ****************
HTH,
Paul
Thanks, 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
100 JPGs:
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
Paul
2018-08-12 18:24:14 UTC
Permalink
Post by Terry Pinnell
Thanks, 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
t***@gmail.com
2018-08-12 21:51:02 UTC
Permalink
Many thanks, Paul. It may take a few days but I’ll persevere.

Terry, East Grinstead, UK
Terry Pinnell
2018-08-12 18:18:53 UTC
Permalink
Post by Paul
Post by Terry Pinnell
Post by Paul
Post by Terry Pinnell
Post by Paul
Post by Terry Pinnell
Post by B. R. 'BeAr' Ederson
Post by Terry Pinnell
Anyone know of a tool or hack that will do something that Win 10 File
Explorer unfortunately cannot: sort a folder of files into aspect ratio
(width/height)?
Although I still think, Dimensions2Folder is best suited for your needs,
http://www.dcmembers.com/skwire/download/dimensions-2-folders
http://www.dcmembers.com/skwire/download/arti
Be sure to (really) try both of them. They are no-install portable.
F-Up set to acf.
BeAr
Thanks BeAr, Dimensions2Folder is a nice tool and it does indeed do what
I want. And on brief acquaintance it has the advantage of being over
three times faster than Mayayana's VBS script. For example, my test
folder of 100 files took 4 s.
Did you try Arti? It appears to be unstable here in Version 1803 (build
17134.167). A few seconds after dragging a folder or multiple files, it
closes unceremoniously.
Terry, East Grinstead, UK
A faster way to get the picture information, would be
to consult Windows.edb instead.
This is a tech demo, not a complete application.
It generates a CSV file which shows all the
images on the path in the SCOPE. Adjust the SCOPE
string to reflect where your image collection is on
disk. If you set the scope to "C:\" then you'll
pick up every 1x1 pixel picture ever invented :-)
What this is doing, is leveraging the three hours spent
by the Windows Search indexer, on your image collection
already.
Yes, you've seen this script before, in a previous
question. I just tweaked it a little bit. You run this
from a "regular user" Powershell. cd to the directory
containing the script, then run it. Powershell will not
run a file from the current working directory, unless
the dot is in front, as shown. I'm not a Powershell
expert, so am not going to be able to dig you out
of trouble all that easily. I'm a "copy/paste expert" :-/
If I can do it with copy/paste, I will.
########### ./little_bobby_tables2.ps1 ################################
#
# Inspiration: https://www.petri.com/how-to-query-the-windows-search-index-using-sql-and-powershell
#
# (Commented out text, is either outright failed stuff, or variants you can test)
#
# At the bottom line, pick a more imaginative filename...
#
# Hint - the less formatting you do in PowerShell, the faster the script runs.
#
# The CSV can be pulled into Excel, LibreOffice Calc, or Notepad.
#
######################################################################
$sql = "SELECT System.ItemFolderPathDisplay, `
System.ItemName, `
System.Image.HorizontalSize, `
System.Image.VerticalSize FROM SYSTEMINDEX `
WHERE System.Image.HorizontalSize>0 AND `
System.Image.VerticalSize>0 AND `
SCOPE='C:\users\Terry Pinnell\Downloads'"
$provider = "provider=search.collatordso;extended properties=Â’application=windowsÂ’;"
$connector = new-object system.data.oledb.oledbdataadapter -argument $sql, $provider
$dataset = new-object system.data.dataset
if ($connector.fill($dataset)) { $dataset.tables[0] | Export-CSV little.bobby.tables.4.csv }
########### end of ./little_bobby_tables2.ps1 ##########################
Paul
Thanks, but I'm having trouble at the first hurdle. Haven't enough time
right now to plunge into learning the basics of Powershell. But as a
start I copy pasted your entire text to my editor and saved it in
C:\Users\terry\Dropbox\Scripts as
./little_bobby_tables2.ps1
(I assumed that's a lower case letter 'l', not the number '1'? But I've
tried both. Neither look like legitimate filenames...
I opened a PS window. What should I now type on the command line to run
that script file? Or how should I rename it?
Terry, East Grinstead, UK
You can rename it to "powertst.ps1" if you want.
That's Pee Esse One as a file extension.
I didn't invent that extension. Microsoft did.
1) Open a Powershell window.
2) .\powertst.ps1
Then open the output file that's been dumped
into the same directory. You could change the
name in the script from "little.bobby.tables.4.csv"
if you want. You could use "powertst.csv" if you
wanted, to make the name shorter.
Paul
A very useful learning exercise, thanks. I now know how to run a
copy/pasted PS1 script. But not a practical route to a solution, as it
delivers only a CSV file, not a folder of selected or renamed files.
BeAr's recommended solution, Dimensions2Folders, is the one I've started
using. But it will also be interesting to see the AWK/GAWK script
Reinhard is developing.
Terry, East Grinstead, UK
Here's my project.
Two files.
The awk file uses Gawk 3.
The binaries link from this page, has the executable.
http://gnuwin32.sourceforge.net/packages/gawk.htm
Gawk calls powershell, to do the database query.
Powershell has a set-executionpolicy, which would
normally be set to "UnRestricted" for home usage.
I had trouble calling Powershell, using the normal technique.
However, to my shock and horror, the shell allows override
being passed to it directly.
powershell -executionpolicy bypass -file query.ps1
It's only running as a regular user, so there's no "elevation
attack" so far by doing this. In any case, mines running :-/
**************** Helper script "query.ps1" ********************
# powershell -file query.ps1 -TREEDIR "'C:\'"
param([string]$TREEDIR="'C:\'")
$sql = "SELECT System.ItemFolderPathDisplay, `
System.ItemName, `
System.Image.HorizontalSize, `
System.Image.VerticalSize FROM SYSTEMINDEX `
WHERE System.Image.HorizontalSize>0 AND `
System.Image.VerticalSize>0 AND `
SCOPE=$TREEDIR"
$provider = "provider=search.collatordso;extended properties=Â’application=windowsÂ’;"
$connector = new-object system.data.oledb.oledbdataadapter -argument $sql, $provider
$dataset = new-object system.data.dataset
if ($connector.fill($dataset)) { $dataset.tables[0] | Export-CSV query.csv }
**************** end of Helper script "query.ps1" **************
**************** "skimmer.awk" ********************
# gawk -f skimmer.awk width height percent scan_path out_dir
#
# gawk -f skimmer.awk 16 9 1 "C:\\" "C:\users\user name\downloads\outdir" < NUL
#
# 0 1 2 3 4 5 (no input file)
#
# ARGC = 6 ARGV[0] .. ARGV[5]
#
# query.csv looks like this, skip the first two lines. There can be commas in the filename!
#
# #TYPE System.Data.DataRow
# "SYSTEM.ITEMFOLDERPATHDISPLAY","SYSTEM.ITEMNAME","SYSTEM.IMAGE.HORIZONTALSIZE","SYSTEM.IMAGE.VERTICALSIZE"
# "C:\Users\user name\Downloads\JPG2","0000014994_1.jpg","669","600"
# "C:\Users\user name\Downloads\JPG2","04.jpg","500","375"
#
###########################################################################
# This is a first cut script, with no error handling or disaster proofing!
# No warranty expressed or implied. Paul.
BEGIN {
if (ARGC != 6) {
print "Usage: width height percent_tol source_tree destdir"
print "gawk -f skimmer.awk 16 9 1 " "\"C:\\\\\" " "\"C:\\users\\user name\\downloads\\outdir\" < NUL"
print ""
print "The program needs five arguments."
print "In some cases, two backslashes may be required on the end of a path, to work."
print "This proof print will then show one backslash as having made it through."
print ""
for (i = 1; i < ARGC; i++) print ARGV[i]
exit 0
} else {
print "Called with"
print ""
for (i = 1; i < ARGC; i++) print ARGV[i]
print ""
width = ARGV[1]+0
height = ARGV[2]+0
percent = ARGV[3]+0
outdir = ARGV[5]
}
# houseclean before run - no collision protection, run one copy only!
cmd = "\"del query.csv\""
system( cmd )
cmd = "\"powershell -executionpolicy bypass -file query.ps1 -TREEDIR \"'" ARGV[4] "'\"\""
print "Query: " cmd
print ""
system( cmd )
# You can redirect stderr ("2") output to clean the output a bit.
# Here, I'm hiding the warning that the directory already exists.
cmd = "\"md \"" outdir "\" 2>NUL\""
print "Cmd: " cmd
print ""
system( cmd )
high = width/height * (1 + percent/100)
low = width/height * (1 - percent/100)
if ( (high < 0) || (low < 0) ) exit 0
i=0
j=0
# No FPAT in Gawk3
FS="\""
while ( (getline < "query.csv") > 0 ) {
if ( i >= 2 ) {
# "C:\Users\xxxx yyyyyyy\Downloads\JPG2","04.jpg","500","375"
# 2 3 4 5 6 7 8
aspect = $6/$8
if ( (high >= aspect) && (low <= aspect) ) {
print $4 " = " $6 " " $8
cmd = "\"copy \"" $2 "\\" $4 "\" \"" outdir "\"\""
print "Cmd: " cmd
system( cmd )
j++
}
}
i++
}
print i " images in tree, of which " j " got copied"
close( "query.csv" )
# The following jazz not required now, as the program has no other clauses
delete ARGV[5]
delete ARGV[4]
delete ARGV[3]
delete ARGV[2]
delete ARGV[1]
}
#END {
# print "Processed " i " lines"
#}
************* end of "skimmer.awk" ****************
HTH,
Paul
Meanwhile these are the steps I tried.

1. Unwilling to test on my very large \Downloads folder I made a global
replacement of 'downloads' by 'Test 10 for 169' in skimmer.awk and
copied my test folder to C:\Users\terry\Test 10 for 169.
But I don't know what to do to these lines:
# "C:\Users\terry\Test 10 for 169\JPG2","0000014994_1.jpg","669","600"
# "C:\Users\terry\Test 10 for 169\JPG2","04.jpg","500","375"

2. I ran skimmer.awk anyway but could see no obvious result. What
*should* I see?

Terry, East Grinstead, UK
B. R. 'BeAr' Ederson
2018-08-10 03:59:04 UTC
Permalink
Post by Terry Pinnell
Did you try Arti? It appears to be unstable here in Version 1803 (build
17134.167). A few seconds after dragging a folder or multiple files, it
closes unceremoniously.
Tested on Win7 and it behaved well. Maybe you try it with less files
and open them by selecting a folder (subfolders option set if needed).
So you could test the functionality, like sorting by aspect ratio,
opening images with the standard program registered for the extension,
copying files, creating a *.csv.

If you find it better suited for your needs than Dimensions2Folders
(likely not), you can inform Jody Holmes about the problem on Win10.
Maybe he can fix it up. Please note, that Jody might appreciate a
donation for this. (And for any extensive usage of his program.) He
is an active part of the Donation Coder community; the donations seem
to be important to him as a kind of respect for his work.

F-Up set to acf.
BeAr
--
===========================================================================
= What do you mean with: "Perfection is always an illusion"? =
===============================================================--(Oops!)===
Terry Pinnell
2018-08-11 10:37:52 UTC
Permalink
Post by B. R. 'BeAr' Ederson
Please note, that Jody might appreciate a
donation for this. (And for any extensive usage of his program.) He
is an active part of the Donation Coder community; the donations seem
to be important to him as a kind of respect for his work.
F-Up set to acf.
BeAr
After donating (for Dimensions2Folders) I saw the forum link and
registered. But have not received activation email. Several attempts,
but still nothing. Also used the Contact route. Tried Live Chat but that
fails too. Just emailed the specified site manager, so maybe that will
work.

Do you know if the site is broken or inactive?

Terry, East Grinstead, UK
t***@gmail.com
2018-08-11 12:35:18 UTC
Permalink
Sorted, that worked and I can now login.
Terry Pinnell
2018-08-17 04:37:43 UTC
Permalink
Post by Terry Pinnell
Anyone know of a tool or hack that will do something that Win 10 File
Explorer unfortunately cannot: sort a folder of files into aspect ratio
(width/height)?
It's an operation I need quite frequently, such as when trying to
isolate all files with say a 16:9 ratio (to some fine tolerance if
necessary).
Terry, East Grinstead, UK
Reinhard has developed a great solution based on GAWK and EXIFTOOL,
pulled together by a batch file.

It's not only marginally faster than Destinations2Folders but also shows
the originals sorted to aspect ratio, which I sometimes prefer before I
split off into subfolders. (That's the approach I used in my own macro -
which was about 150 times slower!)

In practice the source folder, typically a copy of the originals, is
selected and 'Ratio-Rename' selected from the right click context menu,
a shortcut to that batch file having already been copied to the Send To
folder.

The files are then renamed with prefixes defining the AR and sorted by
that name.

My test folder of 100 JPGs and BMPs were processed in under 4 seconds on
this PC under Win 10 Pro (i7, 4.0GHz, 32 GB).

Excellent work, thanks Reinhard!

Terry, East Grinstead, UK
Paul
2018-08-17 06:08:25 UTC
Permalink
Post by Terry Pinnell
Post by Terry Pinnell
Anyone know of a tool or hack that will do something that Win 10 File
Explorer unfortunately cannot: sort a folder of files into aspect ratio
(width/height)?
It's an operation I need quite frequently, such as when trying to
isolate all files with say a 16:9 ratio (to some fine tolerance if
necessary).
Terry, East Grinstead, UK
Reinhard has developed a great solution based on GAWK and EXIFTOOL,
pulled together by a batch file.
It's not only marginally faster than Destinations2Folders but also shows
the originals sorted to aspect ratio, which I sometimes prefer before I
split off into subfolders. (That's the approach I used in my own macro -
which was about 150 times slower!)
In practice the source folder, typically a copy of the originals, is
selected and 'Ratio-Rename' selected from the right click context menu,
a shortcut to that batch file having already been copied to the Send To
folder.
The files are then renamed with prefixes defining the AR and sorted by
that name.
My test folder of 100 JPGs and BMPs were processed in under 4 seconds on
this PC under Win 10 Pro (i7, 4.0GHz, 32 GB).
Excellent work, thanks Reinhard!
Terry, East Grinstead, UK
Here's my test result.

My test folder had 120 files, of which my
criterion of 4:3 with a 1 percent tolerance
caused 47 files to be copied.

The timing function uses "timeit" from rktools.

Loading Image...

I have problems with most of the timing tools I've
used over the years, in that I can't believe what
I'm seeing. I guess I'm not very good at guestimating
time with the ole Mark One Eyeball.

I modified skimmer.awk slightly, to remove some
of the print statements in the output, so the screen
wouldn't be quite such a mess. The debug statements
were left in the version I published, to make it
easier to figure out when something was going wrong.

Paul
Terry Pinnell
2018-08-17 12:26:01 UTC
Permalink
Post by Paul
Post by Terry Pinnell
Post by Terry Pinnell
Anyone know of a tool or hack that will do something that Win 10 File
Explorer unfortunately cannot: sort a folder of files into aspect ratio
(width/height)?
It's an operation I need quite frequently, such as when trying to
isolate all files with say a 16:9 ratio (to some fine tolerance if
necessary).
Terry, East Grinstead, UK
Reinhard has developed a great solution based on GAWK and EXIFTOOL,
pulled together by a batch file.
It's not only marginally faster than Destinations2Folders but also shows
the originals sorted to aspect ratio, which I sometimes prefer before I
split off into subfolders. (That's the approach I used in my own macro -
which was about 150 times slower!)
In practice the source folder, typically a copy of the originals, is
selected and 'Ratio-Rename' selected from the right click context menu,
a shortcut to that batch file having already been copied to the Send To
folder.
The files are then renamed with prefixes defining the AR and sorted by
that name.
My test folder of 100 JPGs and BMPs were processed in under 4 seconds on
this PC under Win 10 Pro (i7, 4.0GHz, 32 GB).
Excellent work, thanks Reinhard!
Terry, East Grinstead, UK
Here's my test result.
My test folder had 120 files, of which my
criterion of 4:3 with a 1 percent tolerance
caused 47 files to be copied.
The timing function uses "timeit" from rktools.
https://s15.postimg.cc/6z9oq7k7v/skimmer_test.gif
I have problems with most of the timing tools I've
used over the years, in that I can't believe what
I'm seeing. I guess I'm not very good at guestimating
time with the ole Mark One Eyeball.
I modified skimmer.awk slightly, to remove some
of the print statements in the output, so the screen
wouldn't be quite such a mess. The debug statements
were left in the version I published, to make it
easier to figure out when something was going wrong.
Paul
Just under a tenth of a second? From clicking 'Go' to seeing your
finished result?

Terry, East Grinstead, UK
Terry Pinnell
2018-08-17 12:44:41 UTC
Permalink
Post by Terry Pinnell
Post by Paul
Post by Terry Pinnell
Post by Terry Pinnell
Anyone know of a tool or hack that will do something that Win 10 File
Explorer unfortunately cannot: sort a folder of files into aspect ratio
(width/height)?
It's an operation I need quite frequently, such as when trying to
isolate all files with say a 16:9 ratio (to some fine tolerance if
necessary).
Terry, East Grinstead, UK
Reinhard has developed a great solution based on GAWK and EXIFTOOL,
pulled together by a batch file.
It's not only marginally faster than Destinations2Folders but also shows
the originals sorted to aspect ratio, which I sometimes prefer before I
split off into subfolders. (That's the approach I used in my own macro -
which was about 150 times slower!)
In practice the source folder, typically a copy of the originals, is
selected and 'Ratio-Rename' selected from the right click context menu,
a shortcut to that batch file having already been copied to the Send To
folder.
The files are then renamed with prefixes defining the AR and sorted by
that name.
My test folder of 100 JPGs and BMPs were processed in under 4 seconds on
this PC under Win 10 Pro (i7, 4.0GHz, 32 GB).
Excellent work, thanks Reinhard!
Terry, East Grinstead, UK
Here's my test result.
My test folder had 120 files, of which my
criterion of 4:3 with a 1 percent tolerance
caused 47 files to be copied.
The timing function uses "timeit" from rktools.
https://s15.postimg.cc/6z9oq7k7v/skimmer_test.gif
I have problems with most of the timing tools I've
used over the years, in that I can't believe what
I'm seeing. I guess I'm not very good at guestimating
time with the ole Mark One Eyeball.
I modified skimmer.awk slightly, to remove some
of the print statements in the output, so the screen
wouldn't be quite such a mess. The debug statements
were left in the version I published, to make it
easier to figure out when something was going wrong.
Paul
Just under a tenth of a second? From clicking 'Go' to seeing your
finished result?
Terry, East Grinstead, UK
OK, I was looking at 'Process Time', my mistake. But I see your Elapsed
Time, is impressive at under 1.5 seconds. That's what I've been
measuring with my stop watch.

I'm curious about what goes on for the other 1.4 s on top of 'Process
Time'?

Terry, East Grinstead, UK
Paul
2018-08-17 16:17:23 UTC
Permalink
Post by Terry Pinnell
Post by Terry Pinnell
Post by Paul
Post by Terry Pinnell
Post by Terry Pinnell
Anyone know of a tool or hack that will do something that Win 10 File
Explorer unfortunately cannot: sort a folder of files into aspect ratio
(width/height)?
It's an operation I need quite frequently, such as when trying to
isolate all files with say a 16:9 ratio (to some fine tolerance if
necessary).
Terry, East Grinstead, UK
Reinhard has developed a great solution based on GAWK and EXIFTOOL,
pulled together by a batch file.
It's not only marginally faster than Destinations2Folders but also shows
the originals sorted to aspect ratio, which I sometimes prefer before I
split off into subfolders. (That's the approach I used in my own macro -
which was about 150 times slower!)
In practice the source folder, typically a copy of the originals, is
selected and 'Ratio-Rename' selected from the right click context menu,
a shortcut to that batch file having already been copied to the Send To
folder.
The files are then renamed with prefixes defining the AR and sorted by
that name.
My test folder of 100 JPGs and BMPs were processed in under 4 seconds on
this PC under Win 10 Pro (i7, 4.0GHz, 32 GB).
Excellent work, thanks Reinhard!
Terry, East Grinstead, UK
Here's my test result.
My test folder had 120 files, of which my
criterion of 4:3 with a 1 percent tolerance
caused 47 files to be copied.
The timing function uses "timeit" from rktools.
https://s15.postimg.cc/6z9oq7k7v/skimmer_test.gif
I have problems with most of the timing tools I've
used over the years, in that I can't believe what
I'm seeing. I guess I'm not very good at guestimating
time with the ole Mark One Eyeball.
I modified skimmer.awk slightly, to remove some
of the print statements in the output, so the screen
wouldn't be quite such a mess. The debug statements
were left in the version I published, to make it
easier to figure out when something was going wrong.
Paul
Just under a tenth of a second? From clicking 'Go' to seeing your
finished result?
Terry, East Grinstead, UK
OK, I was looking at 'Process Time', my mistake. But I see your Elapsed
Time, is impressive at under 1.5 seconds. That's what I've been
measuring with my stop watch.
I'm curious about what goes on for the other 1.4 s on top of 'Process
Time'?
Terry, East Grinstead, UK
I actually hate those little timer programs, because
they never seem to match what I see going on the screen.
In this case, it's possible Windows Defender scans
the files before the run actually starts.

I'm thinking maybe I should be shooting video or something :-)

One possibility, is I could watch the run with Process Monitor,
and use timestamps off that run as a metric.

*******

The results show that the powershell call has more
variation than the file copying.

Here are three runs after booting up.
The Powershell (database query) seems to have a variable time.

The third run is after several repeated invocations,
so is "fully warmed up".

The Timeit time seems to match the gawk stamps.

3:44:57.533 gawk process start
3:44:57.603 powershell.exe process start
3:44:59.913 powershell.exe process exit
3:45:00.988 gawk process exit

Timeit Elapsed Time 3.457 seconds
Timeit Process Time 0.140 seconds

*******

3:57:05.562 gawk process start
3:57:05.623 powershell.exe process start
3:57:07.057 powershell.exe process exit
3:57:08.082 gawk process exit

Timeit Elapsed Time 2.522 seconds
Timeit Process Time 0.125 seconds

*******

4:02:49.400 gawk process start
4:02:49.456 powershell.exe process start
4:02:50.738 powershell.exe process exit
4:02:51.777 gawk process exit

Timeit Elapsed Time 2.379 seconds
Timeit Process Time 0.078 seconds

And I'm not even getting close to yesterdays 1.416 second
time. But some sort of update came in yesterday. Benchmarking
using Windows 10 as a platform is largely a waste of time.
You're not in control.

Paul
Paul
2018-08-18 03:10:18 UTC
Permalink
Post by Paul
Post by Terry Pinnell
Post by Terry Pinnell
Post by Paul
Post by Terry Pinnell
Post by Terry Pinnell
Anyone know of a tool or hack that will do something that Win 10 File
Explorer unfortunately cannot: sort a folder of files into aspect ratio
(width/height)?
It's an operation I need quite frequently, such as when trying to
isolate all files with say a 16:9 ratio (to some fine tolerance if
necessary).
Terry, East Grinstead, UK
Reinhard has developed a great solution based on GAWK and EXIFTOOL,
pulled together by a batch file.
It's not only marginally faster than Destinations2Folders but also shows
the originals sorted to aspect ratio, which I sometimes prefer before I
split off into subfolders. (That's the approach I used in my own macro -
which was about 150 times slower!)
In practice the source folder, typically a copy of the originals, is
selected and 'Ratio-Rename' selected from the right click context menu,
a shortcut to that batch file having already been copied to the Send To
folder.
The files are then renamed with prefixes defining the AR and sorted by
that name.
My test folder of 100 JPGs and BMPs were processed in under 4 seconds on
this PC under Win 10 Pro (i7, 4.0GHz, 32 GB).
Excellent work, thanks Reinhard!
Terry, East Grinstead, UK
Here's my test result.
My test folder had 120 files, of which my
criterion of 4:3 with a 1 percent tolerance
caused 47 files to be copied.
The timing function uses "timeit" from rktools.
https://s15.postimg.cc/6z9oq7k7v/skimmer_test.gif
I have problems with most of the timing tools I've
used over the years, in that I can't believe what
I'm seeing. I guess I'm not very good at guestimating
time with the ole Mark One Eyeball.
I modified skimmer.awk slightly, to remove some
of the print statements in the output, so the screen
wouldn't be quite such a mess. The debug statements
were left in the version I published, to make it
easier to figure out when something was going wrong.
Paul
Just under a tenth of a second? From clicking 'Go' to seeing your
finished result?
Terry, East Grinstead, UK
OK, I was looking at 'Process Time', my mistake. But I see your Elapsed
Time, is impressive at under 1.5 seconds. That's what I've been
measuring with my stop watch.
I'm curious about what goes on for the other 1.4 s on top of 'Process
Time'?
Terry, East Grinstead, UK
I actually hate those little timer programs, because
they never seem to match what I see going on the screen.
In this case, it's possible Windows Defender scans
the files before the run actually starts.
I'm thinking maybe I should be shooting video or something :-)
One possibility, is I could watch the run with Process Monitor,
and use timestamps off that run as a metric.
*******
The results show that the powershell call has more
variation than the file copying.
Here are three runs after booting up.
The Powershell (database query) seems to have a variable time.
The third run is after several repeated invocations,
so is "fully warmed up".
The Timeit time seems to match the gawk stamps.
3:44:57.533 gawk process start
3:44:57.603 powershell.exe process start
3:44:59.913 powershell.exe process exit
3:45:00.988 gawk process exit
Timeit Elapsed Time 3.457 seconds
Timeit Process Time 0.140 seconds
*******
3:57:05.562 gawk process start
3:57:05.623 powershell.exe process start
3:57:07.057 powershell.exe process exit
3:57:08.082 gawk process exit
Timeit Elapsed Time 2.522 seconds
Timeit Process Time 0.125 seconds
*******
4:02:49.400 gawk process start
4:02:49.456 powershell.exe process start
4:02:50.738 powershell.exe process exit
4:02:51.777 gawk process exit
Timeit Elapsed Time 2.379 seconds
Timeit Process Time 0.078 seconds
And I'm not even getting close to yesterdays 1.416 second
time. But some sort of update came in yesterday. Benchmarking
using Windows 10 as a platform is largely a waste of time.
You're not in control.
Paul
Sometimes benchmarking can teach you a lot.

In the first new test case, I threw 50000 JPGs into
my work folder, then had supper while the indexer
indexed them all. In the first case, I selected
aspect ratio files which do not match the majority
of the files. The total time is 4.8 seconds or so.

50144 images in tree, of which 47 got copied

10:09:42.145
10:09:42.192 \__ database lookup time about 3.8 seconds
10:09:45.963 / \___ file copy time about 1 second
10:09:47.028 /

50144 images in tree, of which 47 got copied

*******

In this case, I selected an aspect ratio of 1280x720
which matches all 50000 of the new files. The lookup
of the files still takes 3.8 seconds (because my
search makes no change to how the query is done). But
the file copy took 10 minutes. It needs a speedup
of around a factor of 50. I blame this on all
the subshells getting forked. I would need to rewrite
the code a tiny bit, to fix this.

10:10:28.879
10:10:28.926
10:10:32.736
... dnc <=== computer *crashed* without finishing - nice
timeit=10:00.498 <=== 3.8 seconds database, 596 seconds to copy files

The computer crashed, because I was using procmon to monitor
the experiment, and it exhausted system memory. All of it.
Removing Procmon and rerunning with "timeit" completed
the measurement for me. I did eventually get the
10 minute number.

50144 images in tree, of which 50010 got copied

*******

So there is some value in testing "scaling" a bit.
I don't consider my script taking 10 minutes to
do that, to be very encouraging.

I really wanted to use "robocopy" to transfer
the files, but robocopy doesn't accept a copy_list.
Robocopy would kick ass, given a chance. Using
"copy" like I did, was a poor second choice.

Paul
Terry Pinnell
2018-08-18 20:06:16 UTC
Permalink
Post by Paul
Post by Paul
Post by Terry Pinnell
Post by Terry Pinnell
Post by Paul
Post by Terry Pinnell
Post by Terry Pinnell
Anyone know of a tool or hack that will do something that Win 10 File
Explorer unfortunately cannot: sort a folder of files into aspect ratio
(width/height)?
It's an operation I need quite frequently, such as when trying to
isolate all files with say a 16:9 ratio (to some fine tolerance if
necessary).
Terry, East Grinstead, UK
Reinhard has developed a great solution based on GAWK and EXIFTOOL,
pulled together by a batch file.
It's not only marginally faster than Destinations2Folders but also shows
the originals sorted to aspect ratio, which I sometimes prefer before I
split off into subfolders. (That's the approach I used in my own macro -
which was about 150 times slower!)
In practice the source folder, typically a copy of the originals, is
selected and 'Ratio-Rename' selected from the right click context menu,
a shortcut to that batch file having already been copied to the Send To
folder.
The files are then renamed with prefixes defining the AR and sorted by
that name.
My test folder of 100 JPGs and BMPs were processed in under 4 seconds on
this PC under Win 10 Pro (i7, 4.0GHz, 32 GB).
Excellent work, thanks Reinhard!
Terry, East Grinstead, UK
Here's my test result.
My test folder had 120 files, of which my
criterion of 4:3 with a 1 percent tolerance
caused 47 files to be copied.
The timing function uses "timeit" from rktools.
https://s15.postimg.cc/6z9oq7k7v/skimmer_test.gif
I have problems with most of the timing tools I've
used over the years, in that I can't believe what
I'm seeing. I guess I'm not very good at guestimating
time with the ole Mark One Eyeball.
I modified skimmer.awk slightly, to remove some
of the print statements in the output, so the screen
wouldn't be quite such a mess. The debug statements
were left in the version I published, to make it
easier to figure out when something was going wrong.
Paul
Just under a tenth of a second? From clicking 'Go' to seeing your
finished result?
Terry, East Grinstead, UK
OK, I was looking at 'Process Time', my mistake. But I see your Elapsed
Time, is impressive at under 1.5 seconds. That's what I've been
measuring with my stop watch.
I'm curious about what goes on for the other 1.4 s on top of 'Process
Time'?
Terry, East Grinstead, UK
I actually hate those little timer programs, because
they never seem to match what I see going on the screen.
In this case, it's possible Windows Defender scans
the files before the run actually starts.
I'm thinking maybe I should be shooting video or something :-)
One possibility, is I could watch the run with Process Monitor,
and use timestamps off that run as a metric.
*******
The results show that the powershell call has more
variation than the file copying.
Here are three runs after booting up.
The Powershell (database query) seems to have a variable time.
The third run is after several repeated invocations,
so is "fully warmed up".
The Timeit time seems to match the gawk stamps.
3:44:57.533 gawk process start
3:44:57.603 powershell.exe process start
3:44:59.913 powershell.exe process exit
3:45:00.988 gawk process exit
Timeit Elapsed Time 3.457 seconds
Timeit Process Time 0.140 seconds
*******
3:57:05.562 gawk process start
3:57:05.623 powershell.exe process start
3:57:07.057 powershell.exe process exit
3:57:08.082 gawk process exit
Timeit Elapsed Time 2.522 seconds
Timeit Process Time 0.125 seconds
*******
4:02:49.400 gawk process start
4:02:49.456 powershell.exe process start
4:02:50.738 powershell.exe process exit
4:02:51.777 gawk process exit
Timeit Elapsed Time 2.379 seconds
Timeit Process Time 0.078 seconds
And I'm not even getting close to yesterdays 1.416 second
time. But some sort of update came in yesterday. Benchmarking
using Windows 10 as a platform is largely a waste of time.
You're not in control.
Paul
Sometimes benchmarking can teach you a lot.
In the first new test case, I threw 50000 JPGs into
my work folder, then had supper while the indexer
indexed them all. In the first case, I selected
aspect ratio files which do not match the majority
of the files. The total time is 4.8 seconds or so.
50144 images in tree, of which 47 got copied
10:09:42.145
10:09:42.192 \__ database lookup time about 3.8 seconds
10:09:45.963 / \___ file copy time about 1 second
10:09:47.028 /
50144 images in tree, of which 47 got copied
*******
In this case, I selected an aspect ratio of 1280x720
which matches all 50000 of the new files. The lookup
of the files still takes 3.8 seconds (because my
search makes no change to how the query is done). But
the file copy took 10 minutes. It needs a speedup
of around a factor of 50. I blame this on all
the subshells getting forked. I would need to rewrite
the code a tiny bit, to fix this.
10:10:28.879
10:10:28.926
10:10:32.736
... dnc <=== computer *crashed* without finishing - nice
timeit=10:00.498 <=== 3.8 seconds database, 596 seconds to copy files
The computer crashed, because I was using procmon to monitor
the experiment, and it exhausted system memory. All of it.
Removing Procmon and rerunning with "timeit" completed
the measurement for me. I did eventually get the
10 minute number.
50144 images in tree, of which 50010 got copied
*******
So there is some value in testing "scaling" a bit.
I don't consider my script taking 10 minutes to
do that, to be very encouraging.
I really wanted to use "robocopy" to transfer
the files, but robocopy doesn't accept a copy_list.
Robocopy would kick ass, given a chance. Using
"copy" like I did, was a poor second choice.
Paul
I baulked at 50,000 but I doubled up my 100 successively to 3,200. That
5 GB folder had a wide range of ARs, mostly JPGs, a few BMPs.

The first attempt failed because AWK apparently dislikes filenames
containing spaces, and FE created lots of those, like
20020302-125739-Ashdown6 - Copy - Copy - Copy - Copy - Copy.JPG

But after renaming them simply in Bulk Renamer Utility (0001 to 3200),
the elapsed time of Reinhard's AWK/BAT combo was 18 secs, by stop watch.
If the relationship is roughly linear that would imply 4:40 for 50,000;
close to five minutes.

So, ProcMon, not something to leave running while you have a coffee
then!


Terry, East Grinstead, UK
Paul
2018-08-19 13:27:42 UTC
Permalink
Post by Terry Pinnell
I baulked at 50,000 but I doubled up my 100 successively to 3,200. That
5 GB folder had a wide range of ARs, mostly JPGs, a few BMPs.
The first attempt failed because AWK apparently dislikes filenames
containing spaces, and FE created lots of those, like
20020302-125739-Ashdown6 - Copy - Copy - Copy - Copy - Copy.JPG
But after renaming them simply in Bulk Renamer Utility (0001 to 3200),
the elapsed time of Reinhard's AWK/BAT combo was 18 secs, by stop watch.
If the relationship is roughly linear that would imply 4:40 for 50,000;
close to five minutes.
So, ProcMon, not something to leave running while you have a coffee
then!
Terry, East Grinstead, UK
Here's a new version. query.ps1 shouldn't have
changed. There are now three files in the kit,
plus having to acquire a copy of gawk.exe version 3.

skimmer.awk gawk script
query.ps1 powershell query of Windows Search database
copy.ps1 powershell used to copy output files

gawk.exe gnuwin32 GAWK version 3 for Windows

**************** Helper script "query.ps1" ********************
# powershell -file query.ps1 -TREEDIR "'C:\'"

param([string]$TREEDIR="'C:\'")

$sql = "SELECT System.ItemFolderPathDisplay, `
System.ItemName, `
System.Image.HorizontalSize, `
System.Image.VerticalSize FROM SYSTEMINDEX `
WHERE System.Image.HorizontalSize>0 AND `
System.Image.VerticalSize>0 AND `
SCOPE=$TREEDIR"

$provider = "provider=search.collatordso;extended properties=’application=windows’;"

$connector = new-object system.data.oledb.oledbdataadapter -argument $sql, $provider

$dataset = new-object system.data.dataset

if ($connector.fill($dataset)) { $dataset.tables[0] | Export-CSV query.csv }
**************** end of Helper script "query.ps1" **************

**************** "skimmer.awk" ********************
# gawk -f skimmer.awk width height percent scan_path out_dir
#
# gawk -f skimmer.awk 16 9 1 "C:\\" "C:\users\user name\downloads\outdir" < NUL
#
# 0 1 2 3 4 5 (no input file)
#
# ARGC = 6 ARGV[0] .. ARGV[5]
#
# query.csv looks like this, skip the first two lines. There can be commas in the filename!
#
# #TYPE System.Data.DataRow
# "SYSTEM.ITEMFOLDERPATHDISPLAY","SYSTEM.ITEMNAME","SYSTEM.IMAGE.HORIZONTALSIZE","SYSTEM.IMAGE.VERTICALSIZE"
# "C:\Users\user name\Downloads\JPG2","0000014994_1.jpg","669","600"
# "C:\Users\user name\Downloads\JPG2","04.jpg","500","375"
#
# Powershell copy loop
# Get-Content .\abspathnfile.txt | Foreach-Object { copy-item -Path $_ -Destination "X:\out\"}
#
###########################################################################
# This is a first cut script, with no error handling or disaster proofing!
# No warranty expressed or implied. Paul.
#
# Aug19,2018 Switch to Powershell for file copying. About 1000 files per second.

BEGIN {
if (ARGC != 6) {
print "Usage: width height percent_tol source_tree destdir"
print "gawk -f skimmer.awk 16 9 1 " "\"C:\\\\\" " "\"C:\\users\\user name\\downloads\\outdir\" < NUL"
print ""

print "The program needs five arguments."
print "In some cases, two backslashes may be required on the end of a path, to work."
print "This proof print will then show one backslash as having made it through."
print ""
for (i = 1; i < ARGC; i++) print ARGV[i]
exit 0
} else {
print "Called with"
print ""
for (i = 1; i < ARGC; i++) print ARGV[i]
print ""
width = ARGV[1]+0
height = ARGV[2]+0
percent = ARGV[3]+0
outdir = ARGV[5]
}

# houseclean before run - no collision protection, run one copy only!

cmd = "\"del query.csv copyme.txt\""
system( cmd )

cmd = "\"powershell -executionpolicy bypass -file query.ps1 -TREEDIR \"'" ARGV[4] "'\"\""
print "Query: " cmd
print ""
system( cmd )

# You can redirect stderr output to clean the output a bit.
# Here, I'm hiding the warning that the directory already exists.

cmd = "\"md \"" outdir "\" 2>NUL\""
print "Cmd: " cmd
print ""
system( cmd )

# Checking whether any files in the output folder, will conflict.
# Assumes outdir is one big flat folder, and not a tree!
# The "a-d" removes directory names from the listing.

cmd = "dir /b /a-d \"" outdir "\" 2>NUL"
print "Cmd: " cmd
print ""

dest[ "no file by this name" ] = 0
src[ "no file by this name" ] = 0

while ((cmd | getline) > 0) {
dest[ $0 ] = 0 # holds current outdir filename list
}
close( cmd )

high = width/height * (1 + percent/100)
low = width/height * (1 - percent/100)

if ( (high < 0) || (low < 0) ) exit 0

i=0
j=0
trouble=0

# No FPAT in Gawk3

FS="\""

while ( (getline < "query.csv") > 0 ) { # scan for collisions, make copyme.txt
if ( i >= 2 ) {

# "C:\Users\xxxx yyyyyyy\Downloads\JPG2","04.jpg","500","375"
# 2 3 4 5 6 7 8
aspect = $6/$8
if ( (high >= aspect) && (low <= aspect) ) {
if ( $4 in dest ) {
trouble++
if (trouble <= 20) {
print $2 "\\" $4 " already exists in output directory"
}
}
if ( $4 in src ) {
trouble++
src[ $4 ]++
if (trouble <= 20) {
print $4 " exists " src[ $4 ] " times on copyme.txt list"
}
} else {
src[ $4 ] = 1
}
# do the simplified copy scheme here and make a file list
print $2 "\\" $4 > "copyme.txt"
j++
}
}
i++
}
close( "query.csv" )
close( "copyme.txt" )

if (trouble > 0) { # collision detection on file names...
print ""
print "Trouble detected, " trouble " problems, exiting run before copying anything"
print " Only the first 20 problems are printed to screen"
exit 0
}

# Only copy files if there is no trouble.

cmd = "\"powershell -executionpolicy bypass -file copy.ps1 -TREEDIR \"" outdir "\"\""
print "Cmd: " cmd
print ""
system( cmd )

print i " images in tree, of which " j " got copied"
}
************* end of "skimmer.awk" ****************

**************** Helper script "copy.ps1" ********************
# Source filelist is hardwired to "copyme.txt".
# Accepts a text file of absolute_path_filenames to copy to TREEDIR
# powershell -executionpolicy bypass -file copy.ps1 -TREEDIR 'F:\outdir test'

param([string]$TREEDIR="'X:\does_not_exist'")

Get-Content .\copyme.txt | Foreach-Object { copy-item -Path $_ -Destination "$TREEDIR" }
**************** end of Helper script "copy.ps1" **************

Time for 47 files copied from a scan of 50100 files = 3 seconds
Time for 50000 files copied from a scan of 50100 files = 55 seconds

Paul

B. R. 'BeAr' Ederson
2018-08-18 06:05:15 UTC
Permalink
On Fri, 17 Aug 2018 05:37:43 +0100, Terry Pinnell wrote:

[GAWK + EXIFTOOL script]
Post by Terry Pinnell
It's not only marginally faster than Destinations2Folders but also shows
the originals sorted to aspect ratio, which I sometimes prefer before I
split off into subfolders.
You wrote that you managed to register with the Donation Coder forum.
But I saw no posting wrt your crashes with Arti on Win10. Maybe you
contacted Jody by mail? If you did, you could ask him to add "move"
functionality (in addition to the copy function already present). This
way you could sort by (rounded or exact) ratio, select the ones you
want to deal with, and move them wherever you like. ;-)

I, myself, prefer Total Commander for such tasks (OT in acf). I add the
columns necessary to user defined views (ImgSize and WDX for Images both
support image ratio, for instance), sort by these columns and do whatever
I like to do with the images.

F-Up set to acf.
BeAr
--
===========================================================================
= What do you mean with: "Perfection is always an illusion"? =
===============================================================--(Oops!)===
Terry Pinnell
2018-08-18 08:26:58 UTC
Permalink
Post by B. R. 'BeAr' Ederson
[GAWK + EXIFTOOL script]
Post by Terry Pinnell
It's not only marginally faster than Destinations2Folders but also shows
the originals sorted to aspect ratio, which I sometimes prefer before I
split off into subfolders.
You wrote that you managed to register with the Donation Coder forum.
But I saw no posting wrt your crashes with Arti on Win10. Maybe you
contacted Jody by mail? If you did, you could ask him to add "move"
functionality (in addition to the copy function already present). This
way you could sort by (rounded or exact) ratio, select the ones you
want to deal with, and move them wherever you like. ;-)
I, myself, prefer Total Commander for such tasks (OT in acf). I add the
columns necessary to user defined views (ImgSize and WDX for Images both
support image ratio, for instance), sort by these columns and do whatever
I like to do with the images.
F-Up set to acf.
BeAr
I didn't pursue Arti following its original failure here, as I liked
your first recommendation, Destinations2Folders, which worked straight
off. And as I expect you've seen I now have other alternative solutions
too.

That Donation Coder site is potentially very useful. But its donation
management confusing. But secure: I received a 'key' of over 700
characters, presumably to protect my 'account'!

Terry, East Grinstead, UK
Loading...