Discard downloaded files after a custom script merges them into a single file

Hello!

 

I am very new to MoveIT Automation, and am putting my first task driven by a Custom Script together. What I need to do is download email attachments from a POP mailbox connection, merge the PDF files for a single invoice number together, then send the merged file off to the customer.

 

I have managed to write PowerShell code, leveraging MOVEit's functions and subroutines, that grabs the invoice number from the files, merges the files from each unique invoice together, and output the file to the working directory ready for transfer.

 

What I'm now struggling with is discarding the downloaded files, as they are not needed after the merge is complete. I have tried using $miaclient.MIIgnoreThisFile when iterating through all the attachments but the downloaded files are still processed at the end of the task. I have also tried using Remove-Item (PS) to clear the cache folder after copying out the source files for merging but this then throws the following error (along with several other "AV stole my dingo!" type messages).

 

2025-07-10 13:24:38.466: Cannot access temp file C:\MOVEitCache\10784-54656\atc10102.tmp for source file Message ID messageID@mailserveraddress.com. Possibly it was deleted by a real-time virus checker that I was unable to recognize.

 

All I want is the file I output, I don't want any of the downloaded files - surely there is an easy way to accomplish this?


  • Ian Campbell (Customer)

    Feeling a little silly now that I've discovered I needed to format the MIIgnore as $miaclient.MIIgnoreThisFile($false,$false)!

     

    Still haven't work out how to have an advanced task remove the mail item(s) when it's done processing but I'll get there! (If anyone knows, please feel free to comment...)