[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

OT: running a command on many files in many subdirectories



Never mind, I finished the task.  I just first copied all the files into one 
directory using:

find . -name *.jpg -print | xargs -i  cp \{\} all/  

Then wrote (modified, actually) a shell script to run imageinfo on a bunch of 
files with a different output file each time:

#!/bin/bash

# run imageinfo on many files

 ARGS=2
 E_BADARGS=65

 if [ $# -ne $ARGS ]
 then
   echo "Usage: `basename $0` (extension of input files) (extension of output 
files)"
   exit $E_BADARGS
 fi

{
 for filename in *.$1
 do
  java ImageInfo $filename > "${filename%.$1}.$2"
 done
}
exit 0



Reply to: