////
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at
  http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.
////
:documentationPath: /plugins/actions/
:language: en_US
:page-alternativeEditUrl: https://github.com/apache/incubator-hop/edit/master/plugins/actions/waitforfile/src/main/doc/waitforfile.adoc
= Wait for file

== Description

The Wait for file action can be used to wait for a file. This workflow action will sleep and periodically check whether the specified file exists after which the flow will continue. The action can either wait indefinitely for the file or it can timeout after a certain time.

== Options

[width="90%", options="header"]
|===
|Option|Description
|Workflow action name|The name of the workflow action.
|Check cycle time|The time in seconds between checking for the file. The file will be checked for in the start of the execution and then every "check cycle time" seconds until the maximum timeout is reached. A workflow can only be stopped every "check cycle time" as else the workflow action will be sleeping. A check cycle time of 30 or 60 seconds seems to be a good trade-off between the period until the file is detected and the required CPU usage.
|File name|The name and path of the file to wait for.
|File size check|When this is switched on, once the workflow action detects the specified file, and will only continue if the file size hasn't changed the last check "cycle time seconds". This is useful in cases where a file is created in the final place, and another process is still writing to the file.  (As a best practice, files should be written to a temporary location, and then moved when completed)
|Workflow action name|The name of the workflow action. This name has to be unique in a single workflow.
|Maximum timeout|The maximum timeout in number of seconds, or 0 to wait indefinitely. This is the number seconds after which the flow will continue even if the file was not created. When the timeout is reached the "Success on timeout" option will determine whether the outgoing success or failure hop will be followed.
|Success on timeout|This option determines what to do when the "Maximum timeout" has been reached and the file has not been found. If enabled, the workflow action will evaluate successfully, and the outgoing success hop will be followed. 
|===
