Hitachi

JP1 Version 11 JP1/Script Description and Reference (For Windows Systems)


8.5.23 CatFiles (join split files)

Purpose

Joins split files into one file.

In JP1/Script 07-50 or later, the command supports large files.

Syntax
CatFiles (PathName, [Option], FilePath1, [FilePath2] [, FilePath3 ,) ])
Arguments
PathName

Specify the folder or file in which to save the joined file, using a character string or a variable that stores this value. If you specify an existing file, its contents will be replaced.

Option

Specify the following optional value:

Value

Meaning

Delete

Delete the files specified in FilePathn arguments after they are joined.

FilePathn

Write the full path of each file to be joined, using a character string or a variable that stores this value. You can use a wildcard in the file names.

The files are joined in the order specified, to a maximum of 10 files.

In JP1/Script 06-00 and later versions, you can specify a one-dimensional array variable that stores strings representing the full path of each file. This method allows more than 10 files to be specified.

If you specify a wildcard in a file name, the matching file names are sorted and joined in ascending order.

Description

CatFiles joins the specified files and stores them in the specified folder. The command returns True on successful execution, or False if an error occurs.

Notes
  • Take care when specifying a file or folder in the folder set in the environment variable ProgramFiles (normally the Program Files folder on the system drive) or WinDir (normally the Windows folder on the system drive). For details, see 1.8.2 Command behavior.

  • You can configure access permissions when creating a file to store the joined files. In the following registry key, set the access permissions beforehand:

Registry key

HKEY_LOCAL_MACHINE\SOFTWARE\Hitachi\JP1/Script\SPTX\Option

Value name

SecurityAttributesSucceed

Value datatype

REG_DWORD

Value

0: Access permissions are not set.

1: Access permissions are set to "Inherit access permissions from parent folders".

2: Access permissions are set to "Everyone: Full control".

If no value is set, or a value other than those above is set, the setting defaults to 0.

When the setting takes effect

The setting takes effect the next time the script file is executed.

Important note

The following types of file names are used in a Windows file system:

  • Long file names with character strings specified by a user

  • Short file names automatically generated by Windows (in 8.3 format)

Therefore, if a wildcard is specified in a file name in JP1/Script, the short file names automatically generated by the OS are also included. In addition, if a wildcard is not specified for a file name, the short file name of another file that exists in the same path as the specified file might be the same, resulting in operations being performed on files you did not intend.

Example
' Join the files "A:\FDCOPY.TXT.*" saved to floppy disk,
' and create a joined file "C:\SCRIPT\FDCOPY.TXT".
Dim dir1, file1
dir1 = "C:\SCRIPT\"
file1 = "FDCOPY.TXT"
CatFiles (dir1+file1, , "A:\"+file+"*")
JP1/Script version

Supported from JP1/Script 05-10.