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 whole directory of dll's I need to register to the GAC.
I've got an Active Directory synchronization tool (.NET 2.0 / C#) written as a
I've got a junk directory where I toss downloads, one-off projects, email drafts, and
I've got some code in the lib/ directory that don't really belong under controls,
I've got a script that dynamically calls and displays images from a directory, what
I've got a (mostly) working plugin developed, but since its function is directly related
Got a bluescreen in windows while cloning a mercurial repository. After reboot, I now
got a new blog at wordpress few days ago ( http://ghads.wordpress.com ) and I
Got a class that serializes into xml with XMLEncoder nicely with all the variables
Got myself in a bit of a pickle here ... working on a CMS

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.