Best way to poll for existence of a file?

Jose Lerebours fp at fpgroups.com
Mon Mar 30 05:07:16 PDT 2009


Boaz posted:

> 
> I am updating a shipping system to integrate with UPS's Worldship. I
> was going to use their "Hands-Off" shipping method that polls for the
> existence of a data file in a specific directory and imports the data if
> something exists. It can then generate a file with shipping data like
> tracking number and freight charges to a specific file. I want to poll
> for that file with FPro and import the data when it exists. I am using
> Windows FP 5.6 off a Samba server.
> 
> I was thinking of just setting up one rclerk or rreport operation to
> just sit there and check for the existence of the file every couple of
> seconds or minutes (using SLEEP) and import the data when something
> exists. It just seems a little cludgy to me. Does anyone know of any
> more elegant solution to doing this?
> 
> 

I would use a simple cron script which will scan for (1) if the cron is
already running, (2) if the file exists.

if test -f /appl/docDIR/this_is_the_file.csv
then
  if test -f /appl/docDIR/cron.lock
  then
     :
  else
     /appl/fp/rclerk procFILE -fp cronJOB -a -u -t 165000 -h
"Processing"
  fi
else
fi

A script such as this may be a good start.  Of course, if there is the
chance that you will need to process for than one file, you will need to
use a while loop.

Good luck!


--
Jose Lerebours
http://www.fpgroups.com
954-559-7186
filePro + PHP Solution Developer






More information about the Filepro-list mailing list