Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 827713
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T03:36:57+00:00 2026-05-15T03:36:57+00:00

Ok, I got a directory (for instance, named ‘/photos’) in which there are different

  • 0

Ok, I got a directory (for instance, named ‘/photos’) in which there are different directories
(like ‘/photos/wedding’, ‘/photos/birthday’, ‘/photos/graduation’, etc…) which have .jpg files in them. Unfortunately, some of jpeg files are broken. I need to find a way how to determine, which files are broken.
I found out, that there is tool named imagemagic, which can help a lot. If you use it like this:

identify -format '%f' whatever.jpg

it prints the name of the file only if file is valid, if it is not it prints something like “identify: Not a JPEG file: starts with 0x69 0x75 `whatever.jpg’ @ jpeg.c/EmitMessage/232.”.
So the correct solution should be find all files ending with “.jpg”, apply to them “identify”, and if the result is just the name of the file – don’t do anything, and if the result is different from the name of the file – then save the name of the file somethere (like in a file “errors.txt”).

Any ideas how I can probably do that?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T03:36:58+00:00Added an answer on May 15, 2026 at 3:36 am

    You can put this into bash script file or run directly:

    find -name "*.jpg" -type f |xargs --no-run-if-empty identify -format '%f' 1>ok.txt 2>errors.txt

    In case identify is missing, here is how to install it in Ubuntu:
    sudo apt install imagemagick –no-install-recommends

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a directory location, how can I create all the directories? e.g. C:\Match\Upload
I've got a project in which I have a directory for each aspect of
Greetings, I've got a directory with a list of pdfs in it: file1.pdf, file2.pdf,
Follow up to this question about GNU make : I've got a directory, flac
I've got a site with some administrative pages in its root directory. Question: Is
I've got a routine that grabs a list of all images in a directory,
I've got a library defined by another team. It has something like the following:
I have found a couple of similar questions, but I've got a slightly different
I have got myself a server, and on it I'd like to host my
I've got an msbuild project that tries to establish a global root directory thus:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.