Automatically Load data from all files in directory

I'm new in Unix shell scripting and i need someone to help me to make Script that run all time watching my directory that files uploaded to it via FTP (/mydir/incoming_files), if any files exists in it then (if many files exists, then sort files and load them ascending) it�ll checks the size of the file to make sure that it is not still uploading before it starts load data using oracle sql loader, if size of file is zero then move file to (/mydir/zero_size) directory, else use oracle sql loader to load data to oracle database , after finishing loading data from this file move it to loaded file directory (/mydir/loaded_files) and go to second file if exist do the same like first all time until the directory will be empty. (The directory will be some times empty if files to be uploaded is late but the default is not empty because files will be continue to be uploaded 24/7 *30 )

File name will be <in><some sequence>_<DDMMYYYY><HHMMSS>.dat

System HP UX and Oracle Database

Directories used:

  1. Script directory.(/mydir/scripts) contain scripts used
  2. Incoming files directory. (/mydir/incoming_files)
  3. Loaded files directory (/mydir/loaded_files) in this directory files that loaded to database will be moved to it.
  4. Discarded data files (/mydir/disc_files). This will be used by oracle sql loader to put discarded data file in it , and I need to make it name like <disc>_<original file name>.bad so if file name is in_000023_24082008_182433.dat contain discarded data then discarded file will be disc_in_000023_24082008_182433.bad
  5. Log files directory (/mydir/log_files) this contain log files created by oracle sql loader, and every file will be like it's incoming files with ext. log (in_000023_24082008_182433.log)
  6. Zero size files (/mydir/zero_size) move zero file size to it.

You would help yourself if you also posted some of the script you already have. We do not write scripts from scratch here, but are willing to help those that help themselves