Technical
Tips
I Want to Automatically Transfer the Files in a Specified Directory
Introduction
Today,
we'd like to introduce a tip for transferring files that are placed in a
specified directory.
When
you want to send all of the files in a specific directory at once, it's
possible to use the File Trigger function to monitor and send each individual
file. However, this isn't ideal because, in order to monitor a large number of
files, HULFT needs to create a large amount of management information.
You
can also use HULFT Script's File Trigger function to monitor the directory.
However, because only time stamp monitoring is possible, the trigger might be
set off while files are being copied.
For this tip, we're going to explain how you can send multiple files at once without using the Trigger function. By using HULFT Script to create a monitoring script and using a schedule trigger to periodically check the directory, you can send a group of files consisting of only the files that have already been copied.
Flow of Processing for Automatic Transfer When Files are Placed in a Directory
1.
Create a File Transfer Script to carry out a chain of processes such as
checking for files, moving files, and making transfer requests.
2.
For the schedule trigger that runs every XX minutes, specify the script you
created in step 1.
3.
Every XX minutes, the trigger runs and executes the script to check whether
there are any files in the specified directory and, if there are, to send then.
About File Transfer Scripts
Now, let's talk about what kind of processing File Transfer Scripts actually do.
1.
Acquire a list of files
The
script acquires a list of the files in the target directory.
2.
Check the target files to be transferred
The
script checks whether target files exist, based on the list of files acquired
in step 1.
If
no files exist, processing terminates. If files exist, the script processes the
files one at a time.
3.
Acquire the file names of the files to be transferred
The
script assigns the file names acquired in Step 2 to variables.
4.
Move the target files
The
script moves the target files from the target directory to the in-transfer
directory.
If
a file cannot be moved (for example, because the file is currently being
copied), the script initiates exception handling.
5.
Acquire a list of unnecessary files.
This
processing is only conducted when the file transfer in step 4 fails.
When
the file transfer fails, unnecessary files remain in the in-transfer directory.
The script acquires a list of those unnecessary files.
6.
Check for unnecessary files
The
script checks whether any unnecessary files exist.
7.
Delete unnecessary files
The
script deletes any accumulated files.
8. Send target files
About Schedule Triggers
HULFT Script Schedule triggers are used to check files by running monitoring scripts at intervals.
1. When creating a new schedule trigger, choose Interval.
2. Set the interval between script executions to 3 minutes.
3. For Script, select the script that you created.
4. The trigger is set, and the script will be executed every three minutes.
Conclusion
By
using HULFT Script in this way, you can check the files in a specified
directory at set intervals and, if files exist in the directory, send the
files.
Try creating and using a variety of scripts to fit your operations.