Move files based on status

Hi UNIX Experts,

Kindly help me in this requirement where i want to move files based on its status.
For Eg:
I have 3 dir's
--FileBox Dir
this directory will have all the files which i need to process (in informatica ETL Tool)

--Succeeded Dir
this directory will have files which successfully processed

--Failed Dir
files did not processed
and this is how it should work,

DIR1=tmp/FileBox
DIR2=tmp/Success
DIR3=tmp/Failed
for $file in $DIR1
pmcmd --this command calls my informatica ETL workflow and process the file
if return code for previous command is 0 
mv $file $dir2
else mv $file $dir3

i know this code is not even rough work but this is how my script would work:(
Also is there any way to show which file is in -progress something like if i am processing ABC.txt file then while running my scipt, display:
ABC.txt In - progress and same for other files also.

Please help me out on this.
TIA

Most Unix and Linux commands return an exit status of zero for success and non-zero for failure. Now, the shell can either catch that exit status and run with it (I'll show you that below) or record it in the reserved shell variable $? . Consider:

true
status_val=$?
if [ status_val -eq 0 ]
then echo success
else echo fail
fi

By appending a command with && or || followed by another command you conditionally execute the second command depending on the status of the first:

false && echo this echo will never be executed
false || echo but this one will

You can combine them too:

[[ $(shuf -i 1-100 -n 1) -gt 50 ]] && "echo over 50" || echo "under 50"

I hope this helps you figure out how to write your program.

Andrew

Please specify operating system and shell you are using.
This will help us help you.

Answering couple of questions will determine a complexity of the script required.

Do you intend to run your program scheduled (e.g. cron, at ) ?

How are files written in --FileBox Dir ?
Can a contention happen in case your script will process file which is just being copied ?

Do you need a control if the pmcmd program and your script is already processing file(s) ?

Hope that helps
Regards
Peasant.

My UNIX version:

$ uname -a
Linux ucsdv181.symprod.com 2.6.32-696.10.3.el6.x86_64 #1 SMP Thu Sep 21 12:12:50 EDT 2017 x86_64 x86_64 x86_64 GNU/Linux

-As of now i dont need to schedule my program i just need to run manually

-In FileBox dir files will be place from upstream so i want to group those files based on certain criteria and send each set of grouped files in different different file lists and process these groups parallely and after processing send files to either success or failed folder

-No i don't need control i just need to see which file is being processed
*I have unix script to group these files and create file lists
Let me know if require any other information.

Read the Informatica Command Reference, it has few examples [section: Scripting pmcmd Commands]