WebFaction
Community site: login faq

Hello everybody, is there a way to count the number of images with .png and .jpg extension within a folder/app?

We use Tinyjpg via API (https://tinyjpg.com/developers) and we need to know how many images we are going to compress in order to get a quotation for the service.

Thank you Antonio

asked 31 Jul, 10:03

gosrl
213
accept rate: 0%


From an ssh session, please run the following command:

find /path/to/your/directory/storing/the/images -maxdepth 1 -name "*.jpg" -o -name "*.png" | wc -l

This will show the count of all the files with a png or jpg extension in that directory.

If you want to count all the png and jpg files that exist in deeper directories, you can remove the -maxdepth 1 part.

permanent link

answered 31 Jul, 11:47

iliasr ♦♦
2.0k14
accept rate: 35%

edited 31 Jul, 11:47

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×75
×26
×8
×1

question asked: 31 Jul, 10:03

question was seen: 241 times

last updated: 31 Jul, 11:47

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2016 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM