Hi ,

 

What I have done is using code I have copied the associated xml file to the target folder. I am not sure whether this is the best approach for doing a task like this.

 

The code snippet used to achieve this is below:

 

  //copy to target directory

  set targetFilePath= "\\serverName\targetPath\" _ context.XMLFileName
 
  set archiveFilePath = "\\serverName\archive\" _ $PIECE(context.XMLFileName,".",1) _$ZDATE($H,8)_".xml"
 
  set res=##class(%Library.File).CopyFile(context.XMLFilePath,targetFilePath)
  //Move file to archive folder with filename
  set res=##class(%Library.File).CopyFile(context.XMLFilePath,archiveFilePath)
 
  //compare that the files are the same and then delete
 
  if (##class(%Library.File).Compare(context.XMLFilePath, targetFilePath))
  {
    //delete from the current filepath
    do ##class(%Library.File).Delete(context.XMLFilePath)
  }

 

Is this the best approach or could you suggest a better approach?

 

Kind Regards,

 

Salma