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

  • Home
  • SEARCH
  • 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 7185913
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T18:31:13+00:00 2026-05-28T18:31:13+00:00

I have an installed library called Gdal which runs certain GIS commands. This command

  • 0

I have an installed library called Gdal which runs certain GIS commands.

This command runs for a single file

gdal_translate -a_srs EPSG:25832 INPUT_FILE OUTPUT_FILE

but I would like to run a batch command which iterates through all *.tif files so I don´t have to write the name of each one (i´ve got 1300 files!)

I tried this in a .sh file…but it didn´t work

#!/bin/bash

for FILE in *.tif
do
  BASE=$FILE .tif
  NEWFILE=test/${BASE}.tif
  gdal_translate -s_srs EPSG:25832 $FILE $NEWFILE
done

could anyone show me how to do this?

yours,

Robert

  • 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-28T18:31:14+00:00Added an answer on May 28, 2026 at 6:31 pm

    $FILE includes the .tif extension. Also BASE=$FILE .tif doesn’t do what you think (it executes .tif with $BASE set to $FILE for the duration of the command).

    You also have the difference between -a_srs and -s_srs. I don’t know which you intended.

    The end result is, I think, that you want to use test/$FILE as the output filename.

    #!/bin/bash
    
    for FILE in *.tif; do
      gdal_translate -s_srs EPSG:25832 "$FILE" "test/$FILE"
    done
    

    (The quotes make it work with a path with spaces in it. Putting the for and do on the same line is a common way of writing it to save space.)

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

Sidebar

Related Questions

I have created a Windows Service (called MuskOx) which runs on my development machine
I have installed a sample database, specifically Northwind from http://msdn.microsoft.com/en-us/library/8b6y4c7s.aspx . After installing the
I'm following this walkthrough: http://msdn.microsoft.com/en-us/library/879kf95c(VS.80).aspx In a machine running vista ultimate, I have installed:
I have gdata library install on my ArchLinux, and a simple application which imports
I've installed rails, the mysql2 gem, and mysql and have created a project called
I have a library called example that I'm installing into my global site-packages directory.
I have an application, which uses some 3rd party libraries, for example Tesseract library.
I have compiled a library(GDAL) written in C/C++ with Ruby bindings. After a ran
I have a C++ shared library being called from my Python program. The C++
I have installed a GEM called Ziya using the terminal in Mac OSx. However,

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.