Transfer and Archive example
Please note that this script requires Beyond
FTP Version 2.4.05 or above.
This example demonstrates the use of the "Archive" modifier to guarantee a file is transferred once and only once. Consider a situation where files are being placed in a directory and Beyond FTP is
to transfer these files to a second directory and then archive the transferred files. Several things can go wrong: A file could be in use when the transfer is attempted; An error could occur during the transfer; or a file could be placed in the directory AFTER the files have been expanded and the transfer process has begun. In each case, it is critical that these files not be archived. Only those files that are actually transferred may be removed from the transfer directory and placed in the archive directory.
Download
this script example. |
:MaxPerServer:5 # Transfer 5 files at a time
# The process begins with a file check on the "Polling" directory (the
# same one use in the Local Polling script example).
:IF:
Not
C:\BFTPDemo\Polling\*.*,5
Present
# If there is nothing to move, we quit
:Stop:
:End_If:
# Next we set the archive modifier and perform the transfers.
# We send them to APTServe. Note the use of %LN as a directory
# level so that your results are kept separate from other users.
:Archive:Source
:From: C:\BFTPDEMO\Polling\*.*
:To: {APTServe}C:\Remote Demo\%LN\*.*
# Wait until all transfers have been completed. If there is a failure,
# we send a mail message. In either case, we continue to handle
# the archiving for any files that made it. Those files that were not
# transferred will be moved the next time the script runs.
:IF:
Not Transfer Files
CompletedOK
# Send a mail message indicating that a failure occurred
# (This must be configured. The following is just an example)
:Alert: Mail = C:\BFTPDemo\XferFailed.Mpf
:End_If:
# Now move the files from the Beyond FTP archive directory to your
# system archive.
:Rename_File: C:\BFTPDEMO\Polling\Archive\*.*
:To: C:\BFTPDemo\Save Files\*.*
|