Configuring Tasks - Processes/Scripts - Sample Scripts (Enterprise only)
MOVEit Central Admin installs several different sample scripts into a "sample scripts" subfolder. Several of these are "example only" but a few are generalized versions of production scripts used by several MOVEit Central data center customers. A description of all of these scripts can be found below.
To see VERY basic script examples of just reading in and processing files, you may simply want to use the "Add Script" wizard to create a simple "all at once" or "line-by-line" example.
Finally, it is worth noting that each script runs in a separate thread, so errors in one script will not hurt MOVEit Central or the other tasks MOVEit Central is working on.
"Play" Scripts
- CvtCatalog.vbs - Performs simple XML processing against a file read in line by line.
- Custom Errors.vbs - Example of how to generate custom error codes and messages from a script.
- FixLen Record In.vbs - Reads in a fixed (line) length file, parses it, totals a few columns of numbers, and generates an exception report. Built to work with the files created by "FixLen Record Out.vbs"
- FixLen Record Out.vbs - Randomly generates fixed (line) length data sets to be consumed by "FixLen Record Out.vbs"
- Reverse File.vbs - Reads in a file and writes out the complete contents backwards. (e.g. "fox" becomes "xof")
- StripLF.vbs - Removes newlines from a file.
- Task Groups.vbs - Overwrites a file with the name of the task that is running, and the list of task groups the task belongs to.
"Production" Scripts
- Clean IIS Web Logs.vbs - Used to strip "local" addresses and non-interesting files out of IIS web server logs. Ipswitch uses this script to pre-process the logs from its marketing sites.
- CleanupFolder.vbs -
Used to search through a folder and delete any files that were
last modified more than n days ago and any empty folders (regardless of age).
This script may be used on the local Windows file system only.
To delete remote files use a "No Op" task and configure a filter to only download files older than n days.
(See "Configuring Tasks - Processes/Scripts - Built-In - No Op" for an example.)
Parameters used by this script include:
- folderPath - The path to the folder to cleanup.
- fileAgeDays - Files older than (this value) days will be deleted.
- includeSubfolders - If true, recurse through subfolders. (default=false)
- deleteEmptyFolders - If true, it will delete any folders that are empty. (default=false)
- logToFile - If true, a file named CleanupFolder_yyyy-mm-dd.log
will be created in the "folderPath" directory. This log file
will record each file considered and whether it was deleted or not. (default=false)
- FileSize.vbs - Used to obtain the file size from a single transferred file. This can be used in conjunction with Next Actions. Works with only one file or last file transferred.
- IgnoreSmallFile.vbs - Checks the size of each file processed against a minimum file size specified by a task parameter. Any files smaller than that value are ignored.
- Kick Off Task.vbs - Reads in from a file a "shared secret", a list of task names and runs all the named tasks. Used by a few large companies who like to "kick off" tasks from a mainframe process. (The source in this case is a file on the mainframe's FTP server marked to be deleted after successful transfer; there is no destination.)
- OrigNames.vbs - Compiles a complete list of all the files used by task into a comma-delimited list. Used by people who wish to have a complete list of all files processed by a task sent to them in Next Action emails. (The Next Action message body contains the macro "[Parm:OrigNames]")
- Ping.vbs - Pings several remote hosts to make sure they are still responding; generates an error message if one or more of these hosts goes down. (Used in a task with a single process and one or more Next Actions.)
- PKZipWithPass.vbs - Uses PKZip to compress a file and secure the compressed file with a password. Requires the PKZip application from PKWare.
- PurgeStats.vbs - Purges all entries from the statistics database older than a specified limit. (Note: this sample script was reimplemented as the built-in "Trim Statistics DB" script.)
- Run DOS Command.vbs - Executes a command specified by a task parameter, with arguments also specified by task parameters. The command is something that would normally be run at the command line, like "zip.exe" or "copy". (Note: The functions of this script are also available in the built-in "Command Line App" script.)
- TrimStatsDB.vbs - Goes through the MOVEit Central statistics database and purges entries older than X days. Purged entries may be deleted, copied to text files, or sent to another database. This script is run daily by most heavy Central users, included most datacenters. (Note: this sample script was reimplemented as the built-in "Trim Statistics DB" script.)
See Trimming the database.
- WordCount.vbs - Counts the number of times a particular word appears in source files. The word MOVEit Central looks for is configured in a task parameter; the word count, a brief report and other information is written back into other task parameters. (Note: The functions of this script are also available in the built-in "Find Or Replace" script.)
- ZipAllFiles.vbs - Calls a command-line zip utility to zip up a collection of downloaded files and replace them with the zip file, so that only the zip file gets sent to the task destinations. When used with the "Run Process Once" and "Use Original Names for Cache Files" features, this task allows you to zip up an arbitrary collection of files and folders in one task, compared with two or more tasks for previous methods. (Note: The functions of this script are also available in the built-in "ZipAdvanced" script.)
- ZipDir.vbs - Calls a command-line zip utility to zip a local folder and its contents. Adds the zip file to the list of sources to be processed to destinations. (Note: The functions of this script are also available in the built-in "ZipAdvanced" script.)
- ZipExe.vbs - Uses MOVEit Central's command-line facility to demonstrate how to zip multiple source files into a single ZIP archive. (Note: The functions of this script are also available in the built-in "ZipAdvanced" script.)