check for file existance and generate exit code amd move to another directory

Hi..
i have a file ABC_.txt in source directory which will come evry 30 min and same file will be moved to working directory first time ...and will perform some operations then we archive ABC_.txt ..this will run for 30 min to 45 min
from 2nd time onwards requirement is ...i need to check for the file in working directory ..if it is there then wait for till it is archived or else we need to move from source to working directory .

thanks,
Siva Santosh

So... if the file exists, don't move it, but if it doesn't exist, do? :confused:

after the job run there will be no file in working directory...so we need to check for the file in working directory before moving file from source ...

while true
do
        set -- /path/to/folder/*
        [ -f "$1" ] || break
        sleep 1
done

This will replace your $1, $2, ... parameters.