· May 25, 2022

%File Delete not Working

Hey there,

I'm writing an import Routine to read files into a global. The code is working fine except for the 'Delete' command. The files are being imported, copied but not deleted. Maybe someone has an Idea what ist happening.

I get the low level return value of -32 but i couldn't find anywhere to show me what that actually means. And my Caché version doesn't support the $ZU command.

Here's the Code

 SET PATH="C:\inetpub\ftproot\File_Import\"
 SET ARCHIVPATH="C:\inetpub\ftproot\File_Import\Imported\"
 SET FAILPATH="C:\inetpub\ftproot\File_Import\Failed\"
   .SET STREAM=##class(%Stream.FileCharacter).%New()
   .DO STREAM.Rewind()
   .SET DATA=""
   .SET LINE=STREAM.ReadLine()
   .IF ($L(DATA)+$L(LINE))>3600000 SET LIMIT=-1
   .IF LIMIT=-1 Q
       .SET DATA=DATA_LINE_$C(13)_$C(10)
    .IF LIMIT'=-1 DO ##class(%File).CopyFile(FILE,ARCHIVPATH)
    .IF LIMIT=-1 DO ##class(%File).CopyFile(FILE,FAILPATH)
    .do ##class(%File).Delete(FILE, .RETURN)

 Output for a single file is: 


Thank you for any advice.

Product version: Caché 2017.1
$ZV: Cache for Windows (x86-64) 2017.2 (Build 744U) Fri Sep 29 2017 10:58:27 EDT
Discussion (7)1
Log in or sign up to continue