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 8378853
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T16:01:34+00:00 2026-06-09T16:01:34+00:00

I use linux, bash. I have a bunch of image files in several directories.

  • 0

I use linux, bash.
I have a bunch of image files in several directories. All have specific names that must be saved (filenames AND directories). But I need to convert all images to different size and ppi. I used the
convert -units PixelsPerInch 75 -resize 200x200 ~/filepath/*.jpg ~/filepath.*jpg
but it replaced the wrong file. Also I’ve tried
"{}" "{}"%03d.jpg
to add a number to the new filename but it gives only 001.jpg etc.
Solutions like
Bash – get last dirname/filename in a file path argument
or
Extract filename and extension in Bash
with ${filename%.} and other parts of scripts
or
http://bytebar.blogspot.com/2008/08/bash-filename-extraction.html
do not work or I have no such knowledge to understand the code…
How can I convert those files keeping their names and directories?

  • 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-06-09T16:01:35+00:00Added an answer on June 9, 2026 at 4:01 pm
    ls ~/filepath.*jpg | xargs -n 1 -I{} convert -units PixelsPerInch 75 -resize 200x200 {} {}
    

    “xargs -n 1” calls the following function with provided arguments one at a time.
    The -I{} argument of xargs, tells xargs to replace each occurence of {} with the given argument.

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

Sidebar

Related Questions

What Linux commands would you use successively, for a bunch of files, to count
Working in bash under Linux ubuntu 10 here I have Bash script that reads
I have a bunch of files (with same name, say abc.txt) strewn all over
I use EditPlus to write linux bash programs. after writting when i move files
Bash 4 on Linux ~ I have an array of possible values. I must
I am running GNU bash, version 3.2.39(1)-release (x86_64-pc-linux-gnu). I have a specific question pertaining
I have a cross platform product that gets deployed to several Linux distros and
While I use Linux, I have not yet customized my bash shell, which I
I'm using linux and bash I have two files filea.wav and fileb.wav which are
I have a bash script on a Linux box that runs a Jar file.

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.