The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Special Forums > UNIX and Linux Applications
Google UNIX.COM



View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 11-08-2007
Smiling Dragon's Avatar
Smiling Dragon Smiling Dragon is offline
Disorganised User
 
Join Date: Nov 2007
Location: New Zealand
Posts: 674
I might be misunderstanding your question but there's what I make of it:

You have a bunch of files.
You want to run your script over the files, one by one, moving them into either a success or failure folder depending on the outcome of the script. Right?

If so, I'd do something like this:
Code:
for file in <input file dir>/* ; do if script2.sh $file ${file}.output ; then mv $file <success dir>; else mv $file <failure dir>; fi ; done
If you want the output to move with the input file, add another mv command to each of the sections of the if statement.
Reply With Quote