terminalcommand-linegopro

What is the best way to recursively run a Terminal command with a changing variable in the command?


I have a few thousand GoPro RAW images, and the best way to convert them to a workable format is to use their command line conversion tool in the following format:

$ gpr_tools -i /path/G0028513.GPR -o /path/G0028513.DNG

The filenames are sequential, so is there is a way to create a loop where I have a start and end variable that represents the first and last files (eg. 28513, and 33512), and add one to that number on each iteration to use in the two "path" sections of the command?


Solution

  • for i in {16243..28784}
    
    do
    
      /gpr/build/source/app/gpr_tools/gpr_tools -i /path-to-GPR-files/G00$i.GPR -o /path-to-DNG-folder/G00$i.DNG
    
    done
    

    Happy shooting!