In windows, filter and delete image based on dimension(or any search filters for that matter)

0

In windows explorer, I can filter a folder based on the dimension criteria, say: width:<800 height:<600 (so that I filter small images) height:>2000 (so that I filter portraits) and then delete them.

Is there a way to automate this? It can be powershell, batch, any freeware.

Koay Chiang Teik

Posted 2014-08-20T05:11:49.717

Reputation: 23

Check this answer: https://superuser.com/a/380108/508402. You can also do it in powershell (see Get-ChildItem).

– CFreitas – 2017-04-10T09:47:38.073

Answers

0

I suggest Batch Images. Though it's not freeware, it can accomplish your task.

Basic Setup

First you specify which images you want to find and delete as follows:

  1. Click on the button to search for images

Search button

  1. In the dialog that appears, specify where to look for images, file name pattern, basic file properties:

Search dialog

  1. Under Image Properties tab under Size subtab, specify the dimension requirements for the images (those that match will be selected):

Image props

  1. Now click Search and it will scan and add only matching images from all the folders, producing a list that you can work with:

list

  1. Depending on whether you want to buy the program (everything up to this point can be done with a free version), you have several options:

5.1. Buy the program and use built-in Delete Files quick task to delete those specific images:

delete images

5.2. Alternatively you can delete those images semi-manually: 5.2.1. First you save the list of images that matched the criteria using the Save Image List button:

enter image description here

5.2.2. The file created will be a plain text file containing a full path to the image - one per line. You then open that file in Notepad or other free editor and add del before every line:

notepad

5.2.3. Save the file in notepad under new bat extension and simply double-click on that file in Explorer to execute it. It will delete all the images listed in that file.

Automation

Now, so far what is described is only an automation in a sense that you can capture all the images that match your criteria in one batch, but you still have to do it manually. If you require full automation, you can do it with paid version of Batch Images, using one of the 2 additional modes:

1) Continuous background scanning mode that will basically scan specified folders for specified images (the same way as how I described above) but automatically, every few minutes; and then will automatically perform requested actions on those that match criteria (in your case delete files):

bg mode

2) Scheduled / command line mode. Basically you save your image search from steps 1 - 3 above as a template, and then pass that template file along with some other command line arguments to the program, and the program will find and delete images that match criteria - from command line without showing any UI (other than optional console window). And this of course, you can automate with Windows Task Scheduler (actually you can also do it from within the program UI, which is a more convenient way).


Forgot to mention that the "basic setup" part can also be done with free XNView. However, it does not offer the additional automation you require. But it, too can find images matching criteria and produce a list of them that you can then work with manually.


Disclaimer: I am a user of paid version of Batch Images and use it frequently for my image processing needs. I also use XNView often.

George

Posted 2014-08-20T05:11:49.717

Reputation: 282