read files from folder and then call another script

Hi,

I am new to the Unix shell scripting world. It would be great if some body can help me with my requirement

1) Script (say script1.sh) which will take set of files from one folder (say input folder).
2) Take the first file from the folder and execute another script (script2.sh).Pass 2 parameters - one input file(file1) and another output file(file1.out).
Script2.sh /input/file1 log/file1.out (this script is already working)

3) On completion of the script2.sh - if it is a success then move the input file from the input folder to another (say success) folder. If the execution of script2.sh is a failure then move the input file from the input folder to another (say failure) folder
4) Repeat the step # 2 and #3 until all the files are processed from the input folder

Thanks in advance,
Girish

Hi,

Can somebody give some idea on this.

Thanks

find sourceDir -type f | while read N
do
       if someScript.sh "$N" log/`basename "$N"`.log
       then
              mv "$N" success
       else
              mv "$N" failure
       fi
done

Of course what this does not do is check for duplicate filenames etc.

Seems pretty simple.

for FILE in $INPUT_FOLDER/*; do
  Script2.sh $FILE /log/${FILE##*/}.out
  if [[ $? -eq 0 ]]; then
     mv $FILE $SUCCESS_FOLDER
  else
     mv $FILE $FAILURE_FOLDER
  fi
done

Something like that?