如果我使用相同的过程编辑器运行 OS-DELETE,它会删除,但如果我运行应用程序,它会复制文件,但删除不会发生。 代码如下:
当“处理”时,那么 做:
OS-COPY VALUE(TT-ACT-FILES.FilePath) VALUE(TT-ACT-FILES.ProcessedPath).
/* Check if the copy operation resulted in an error */
IF ERROR-STATUS:ERROR THEN DO:
MESSAGE "Error copying file: " ERROR-STATUS:GET-MESSAGE(1) VIEW-AS ALERT-BOX.
RETURN.
END.
/* Debug message for the copy operation */
MESSAGE "File copied successfully from :" (TT-ACT-FILES.FilePath) " to " (TT-ACT-FILES.ProcessedPath) VIEW-AS ALERT-BOX.
/* Check if the source file exists before deletion */
IF SEARCH(TT-ACT-FILES.FilePath) <> ? THEN DO:
/* Attempt to delete the original file */
OS-DELETE VALUE(TRIM(TT-ACT-FILES.FilePath)) NO-ERROR.
/* Check if delete operation was successful */
IF ERROR-STATUS:ERROR THEN DO:
MESSAGE "Error deleting original file: " ERROR-STATUS:GET-MESSAGE(1) VIEW-AS ALERT-BOX.
END.
ELSE
MESSAGE "Original file deleted successfully." VIEW-AS ALERT-BOX.
END.
ELSE
MESSAGE "Source file does not exist for deletion: " (TRIM(TT-ACT-FILES.FilePath)) VIEW-AS ALERT-BOX.
结束。
您应该在 OS-... 语句之后检查 OS-ERROR 函数。
https://docs.progress.com/de-DE/bundle/abl-reference/page/OS-ERROR-function.html