We Use Cookies

We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with this.

See our cookie policy.

Automation Action: File Operation

Perform various operations on files & folders.

Built-In Action

Create new folders, copy, move, rename, check exists, delete files and get file information.

Use this Action to create new folders or to copy, move, check if files exists, rename & delete files and get file information. You can also use this action to generate an SHA256 hash (checksum) for any file.

Select the Operation Type:

  • Create Folder
  • Copy File
  • Move File
  • Delete File
  • Rename File
  • Check If File/Folder Exists
  • Get SHA256 Hash For File
  • Get File Size
  • Get File Date
  • Get File Version
  • Read File To Base64 String
  • Write Binary File From Base64 String
  • Append To Filename
  • Prefix Filename
  • Get Folder Contents

Depending on the Operation Type enter the Folder, File Name, To Folder & To File Name.

You can assign the result to a variable. Select from the Assign To Variable list. The variable will be set to the new folder and file name depending on the Operation Type. For example, for the Create Folder operation the variable will be assigned to the new folder name. For the Copy operation the variable will be assigned the full path & file name of the new file. If the operation fails the variable will be assigned a blank string and the error will be shown in the log. The Check If File/Folder Exists operation will return the file/folder path is the file/folder exists, otherwise blank.

The Append To Filename and Prefix Filename operations allow you to append text or prefix text to existing file names. For example: If the Append Text is set to 'abc' and the processed filename was 'order.pdf' then the existing file will be renamed to 'orderabc.pdf'.

The Copy, Move, Delete, Append To Filename & Prefix Filename operations allow the File Name to contain wildcards. If using wildcards enable the Match Files Using Wildcards option. The File Name can contain * and ? wildcard characters. When using wildcards, if multiple files are processed then the Assign To Variable will contain a list of files processed separated by commas.

For the Copy operation you can specify the To File Name (when not using wildcards). You can specify a different destination file name. If this entry is blank the original file name will be used.

For the Copy operation you can enable the Overwrite Existing option if you want existing files in the destination folder to be overwritten. If this option is not enabled and an existing file already exists then an error will raised.

The Get File Version operation returns file information in the following format:

File:             D:\ThinkAutomation\Setup Files\ThinkAutomation.exe
InternalName:     ThinkAutomation
OriginalFilename: ThinkAutomation.exe
FileDescription:  ThinkAutomation Installer
Product:          ThinkAutomation
Debug:            True
Patched:          False
PreRelease:       False
PrivateBuild:     False
SpecialBuild:     False
Language:         English (United Kingdom)              

For the Create Folder operation the complete folder structure will be created if any levels do not exist. If the full folder already exists the Assign to variable will be assigned the existing folder name and no error will be reported. An error will only be reported for the Create Folder operation if the creation of a new folder fails.

The Get Folder Contents operation returns a list of files in the specified Folder and Mask. The list will be assigned to the Assign To variable with each file separated by a comma. The full path and filenames are returned. You can use the For Each.. Comma Separated Value In action to loop through the list of files.

If you are access folder/files on your network you will need to change the user name that the ThinkAutomation Message Processor Service runs under.