Sponsored Content
Special Forums UNIX and Linux Applications read files from folder and then call another script Post 302144581 by Smiling Dragon on Thursday 8th of November 2007 08:52:07 PM
Old 11-08-2007
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.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

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... (3 Replies)
Discussion started by: girishnn
3 Replies

2. Shell Programming and Scripting

shell script to call other files..plz help

Hi all, I have a number of shell script,perl script.. etc in a directory,which i need to execute in some order.Now i need to create a script to call all these files in that order..so that the new script will execute all the files one by one....plz help this is urgent. Thanks In advance Anju (3 Replies)
Discussion started by: anju
3 Replies

3. Shell Programming and Scripting

script for Finding files in a folder and copying to another folder

Hi all, I have a folder '/samplefolder' in which i have some files like data0.txt, data1.txt and data2.txt. I have to search the folder for existence of the file data0.txt first and if found have to copy it to some other file; next i have to search the folder for existence of file... (5 Replies)
Discussion started by: satish2712
5 Replies

4. Shell Programming and Scripting

Running a script with all files in a folder

Hi I have many files in a folder (like 200) and I want to run a Perl script through all of them. One way would be to do it one by one (which will take forever). But I am sure there is a faster way of doing it. So inside the folder i have files named in no particular way eg. YUI456... (3 Replies)
Discussion started by: phil_heath
3 Replies

5. UNIX for Dummies Questions & Answers

Script for checking the files in a folder

Hi , I am using the below script for checking for a file in a folder. if ; then echo 0 else echo 1 fi Is there any way we can check for files which are starting with GL*.csv.What I am trying to do is , I have to check in a folder for the GL*.csv files if there are any files they I... (6 Replies)
Discussion started by: wangkc
6 Replies

6. Shell Programming and Scripting

How to create a shell script to read a foldername from a text file and go to the folder?

Hi, I am trying to write a shell script which can read folder names from a text file and then go to the folder and picks up a xml file and write on my sipp script so that I can run the sipp script. For example: I have a text file called thelist.txt where I have provided all the folders... (7 Replies)
Discussion started by: pm1504
7 Replies

7. Shell Programming and Scripting

Read line of files and call store procedures

Hi, I wish to write a piece of code to read lines of the flat file and cut each lines of record to a variable, then use this variable to pass as an parameter of a Sybase stored procedures, if there are 5 lines of record from the text file, then this stored procedures will be called 5 times.... (8 Replies)
Discussion started by: newbie2011
8 Replies

8. Shell Programming and Scripting

Bash script read specific value from files of an entire folder

Hello, I heva a problem creating a script that read specifc value from all the files of an entire folder I have a number of email files into a directory and i need to extrect from each file 2 specific values. After that i have to put them into a new file that looks like that: To: value1 ... (1 Reply)
Discussion started by: ahmenty
1 Replies

9. Shell Programming and Scripting

Read files into variable using then pass to delete call

I am trying read all the files from list into a variable line using bash. After there are read into the variable they are passed to a delete call. The files appear to be read line (as I can see them with the echo) by line into the variable, but the delete call is not removing them and I do not... (1 Reply)
Discussion started by: cmccabe
1 Replies

10. Shell Programming and Scripting

Request for Shell script to move files from Subfolder to Parent folder and delete sub folder

Hi Team, I am new to shell script and there is a requirement where files should be moved from Subfolder to parent folder. Eg: parent folder --> /Interface/data/test/IN Sub folder -->/Interface/data/test/IN/Invoice20180607233338 Subfolder will be always with timestamp... (6 Replies)
Discussion started by: srivarun15
6 Replies
ppmquantall(1)						      General Commands Manual						    ppmquantall(1)

NAME
ppmquantall - run ppmquant on a bunch of files all at once, so they share a common colormap SYNOPSIS
ppmquantall [-ext extension] ncolors ppmfile ... DESCRIPTION
Takes a bunch of portable pixmap as input. Chooses ncolors colors to best represent all of the images, maps the existing colors to the new ones, and overwrites the input files with the new quantized versions. If you don't want to overwrite your input files, use the -ext option. The output files are then named the same as the input files, plus a period and the extension text you specify. Verbose explanation: Let's say you've got a dozen pixmaps that you want to display on the screen all at the same time. Your screen can only display 256 different colors, but the pixmaps have a total of a thousand or so different colors. For a single pixmap you solve this problem with ppmquant; this script solves it for multiple pixmaps. All it does is concatenate them together into one big pixmap, run ppmquant on that, and then split it up into little pixmaps again. (Note that another way to solve this problem is to pre-select a set of colors and then use ppmquant's -map option to separately quantize each pixmap to that set.) SEE ALSO
ppmquant(1), ppm(5) AUTHOR
Copyright (C) 1991 by Jef Poskanzer. 27 July 1990 ppmquantall(1)
All times are GMT -4. The time now is 10:10 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy