MoveFile |
Top Previous Next |
Syntax - MoveFile {<SourceFilePathAndName>|InputFile|LogFile|} <DestinationFilePathAndName> Where: InputFile is a keyword that identifies the file defined in the SetStartup InputFile command or in the OPTIONS command. LogFile is a keyword that identifies the file defined in the SetStartup LogFile command. <DestinationFilePathAndName> is a literal string or a variable that contains a string.
Description: This command is used to move the file specified in the literal string <SourceFilePathAndName> or by the keywords InputFile and LogFile, to the file specified in the literal string <DestinationFilePathAndName>. <SourceFilePathAndName> is a valid path and file name that is accessible from the workstation on which EMUE is running. <DestinationFilePathAndName> is a valid path and file name that is accessible from the workstation on which EMUE is running. This path can be local, on a network, or on an FTP server. The key term #TODAY# can be used in the literal string that defines the <DestinationFilePathAndName> to insert the current date in file name. The key term #TODAY# is replaced with the current date in the format MMDDYY. The key term #TIME# can be used in the literal string that defines the <DestinationFilePathAndName> to insert the current time in file name. The key term #TIME# is replaced with current time in the format HHMMSS. The key term #INPUTFILENAME# can be used in the literal string that defines the <DestinationFilePathAndName> to insert the file name defined in the SetStartup InputFile command into the file name. The key term #INPUTFILENAME# is replaced with the file name defined in the SetStartup InputFile command without its extension. The key term #SCRIPTFILENAME# can be used in the literal string that defines the <DestinationFilePathAndName> to insert the script file name without extension into the file name. The key term #SCRIPTFOLDER# can be used in the literal string that defines the <DestinationFilePathAndName> to insert the folder path where the script file is located. The key terms #TODAY#, #TIME#, and #INPUTFILENAME# can also be used to identify the source file. These keywords should be used carefully. For example, #TIME# is replaced with the current time when this line of the script is run. It is unlikely to match a timestamp in the name of the file. #TODAY# would be useful for a file created with a time-stamp in the same day, but be sure that the date formats match otherwise the file names will not match. The key term #COMPUTERNAME# can be used in the literal string that defines <DestinationFilePathAndName> to insert the name of the computer where the script is running.
Note: If the keywords LogFile or InputFile are used, the file will be closed (if necessary) before it is copied and will no longer be available to the script. After the file is moved any script command that references the file will result in an error. It is recommended that use of this command be reserved for use at the end of a script.
Note: If a literal string that is used to define a path and file does not begin with a drive letter or two backslashes ("\\"), the path will be treated as relative to the directory that contains the script file.
Note: If the literal string that defines the <DestinationFilePathAndName> ends with a backslash "\" or with the wildcard indicator "\*.*", EMUE will place the file in the designated directory, without renaming it.
Note: If the <SourceFilePathAndName> is equal to the <DestinationFilePathAndName> according to a string comparison, there will be an EMUE error and the file will not be moved.
Note: If the path does not exist, EMUE will create it.
Note: The FTP form of this feature is not supported in EMUE Standard.
Sample 1: The following statement moves the file “C:\somefile.txt” from the C: drive to the D: drive and adds a time and date stamp. MoveFile "c:\somefile.txt" "d:\somefile_#TODAY#_#TIME#.txt"
Sample 2: The following statement moves the file “C:\somefile.txt” from the C: drive to the D: drive without renaming it. MoveFile "c:\somefile.txt" "d:\"
Sample 3: The following statement moves the file identified in the SetStartup InputFile command to the "Archive" sub-directory under the directory that contains the script file and renames the file to a file name that includes the current date. MoveFile InputFile " \archive\Processed#TODAY#.txt"
Sample 4: The following statement moves the file "C:\EMUE\appts.txt" to the "Archive" sub-directory on an FTP server and renames the file to a file name that includes the current date. MoveFile "C:\EMUE\appts.txt" "ftp://111.22.22.1/Archive/appts_#today#.txt"
See Also:
|