Page 1 of 1

Datafile Transfer after Sequence Ends

Posted: Wed Jan 07, 2015 4:24 pm
by SMinero
I am trying to use a macro to automatically copy datafiles to another location after the sequence has completed. The macro calls for a FileStat(MODE, DestDir$) command, but I am unable to succesfully define the MODE. Can anyone help or provide a list of variables?

The macro is as follows:

Author Niels Waleson
!Date 28 Oct 1997
!ChemStation G2070AA All version

!\usermacs\lc\38

!Not supported, request can be send to the author.

!This macro will copy during a sequence the files
! to a specified directory at the end of a run

!Load this file in \hpchem\core\user.mac
!Use in RunTime CheckList as PostRun command: SaveTo "E:\MYDATA"

Name SaveTo
Parameter DestDir$
!Step out if not in sequence
If _SequenceOn = 0 Then
Return
EndIf
!Create the destination directory
If FileStat(MODE, DestDir$) = -1 Then
MkDir DestDir$
EndIf
!Create the destination sequence sub directory
If FileStat(MODE, DestDir$ + "\" + _DataSeqSubDir$) = -1 Then
MkDir DestDir$ + "\" + _DataSeqSubDir$
EndIf
!If the datafile is already there write an error in the logbook
If FileStat(MODE, DestDir$ + "\" + _DataSeqSubDir$ + \
"\" + _DataFile$) = -1 Then
Copy _DataPath$ + _DataSeqSubDir$ + "\" + _DataFile$, \
DestDir$ + "\" + _DataSeqSubDir$ + "\" + _DataFile$
Else
WriteToLogBook "SaveTo error: File already exist"
WriteToLogBook DestDir$ + "\" + _DataSeqSubDir$ + "\" + _DataFile$
EndIf
Return

Re: Datafile Transfer after Sequence Ends

Posted: Thu Jan 08, 2015 4:53 pm
by GasMan
Here is the information about the FileStat command

Gets the status of the specified file or directory.

Group

File Manipulation Commands

Syntax

FILESTAT( Selector, Name )

Parameters Type/Description

Selector Keywords: SIZE, MODE, OPERM, GPERM, PERM, TIME
Name String expression evaluating into a valid filename or directory name

Discussion

Function returns specific status information of the specified file or directory depending on the given Selector. The selectors cannot be abbreviated. A filename or directory name without absolute path is specified from the applications current working directory. Wild characters as part of filename or directory name are not allowed.
Depending on the selector the following states of the file can be retrieved:

SIZE Returns the size of the file specified in bytes. For Directories 0 is returned always.
MODE Returns the following information :

-1 = file/directory not found
1 = regular file
2 = directory
3 = character special
(4 = block special -- never returned in this version)
(5 = fifo -- never returned in this version)

PERM Returns the permission of a file. For Directories 7 is returned always.

-1 = File/directory not found.
0 = No permission set on file.
1 = Execution permission (for named application).
2 = Write permission (for named application).
3 = Write and execution permission (for named application).
4 = Read permission (for named application).
5 = Read and execution permission (for named application).
6 = Read and write permission (for named application).
7 = Read, write and execution permission (for named application).
( In this version OPERM, GPERM return the same as PERM )

TIME Returns time of the last modification of the file/directory. The value is the calendar time in seconds.

Return Value

Number, interpretation depends on Selector.

Copyright (c) 1990-2002 Agilent Technologies


Gasman

Re: Datafile Transfer after Sequence Ends

Posted: Thu Jan 08, 2015 6:44 pm
by SMinero
Thank you for your response!! I will try this.