Script Library

Sample scripts are provided as-is with no warranty of fitness for a particular purpose. These scripts are solely intended to demonstrate techniques for accomplishing common tasks. Additional script logic and error-handling may need to be added to achieve the desired results in your specific environment.


vms-no-version.s

Download

A filename on a VMS server may be expressed as [name].[extension];[version]

You can use the SETSUBSTR script command to detect filenames with version information and the SETEXTRACT command to remove the semicolon and version.

The following sample script connects to an FTP site hosted on a VMS server and downloads all files in the root directory to the current local working directory. The downloaded files are saved to the local computer without version numbers in the file names.

WARNING: When you remove the version number there is a possibility that a newer file will be overwritten by an older version.


  1  ;; MyVMS is a Managed Site defined in the Configurator
  2  FTPLOGON "MyVMS"  
  3  IFERROR RETURN 
  4  :find_site_file
  5  FTPGETFILE "*"  
  6  IFERROR RETURN $ERROR_SUCCESS
  7  
  8  SET local_file_name = %sitefile
  9  SETSUBSTR version = %sitefile ";"
 10  IFNUM= version 0 GOTO download_file
 11  SETEXTRACT local_file_name = %sitefile ";"  1
 12  
 13  :download_file
 14  RCVFILE %sitefile /as local_file_name 
 15  IFERROR RETURN
 16  goto find_site_file

Browse complete list of scripts