Deleted file still showing in Log Message

My process creates a .txt file and takes that file and a PDF and compresses it into a zip. When the original PDF is taken from an email, a .jpg file shows up with it. I delete the .jpg file (successfully) but i get an error that i can’t compress the 2 files.

When i look at my log messages, i see that the .jpg is still listed as part of my PDF location. I don’t know how to get rid of it.




You’re probably reading the files into a list/array with Directory.GetFiles and putting that into a variable. So the variable still has that same value later. In other words if you have the files “test1.txt” and “test2.txt” and do Directory.Getfiles now you have {“test1.txt”,“test2.txt”} in a variable. Deleting the file test1.txt doesn’t remove it from the variable. There’s no link between the two.

Hello @atarantino ,

You can use a move file activity and move only the pdf to another folder and zip that folder.
Else you can use the below expression to get only the .jpg files.

MyFilelist = Directory.GetFiles(_folderPath,”*.jpg”,System.IO.SearchOption.AllDirectories)

Thanks for the response. How would i get rid of the .jpg before i zip?

Use Directory.GetFiles again to get a list of remaining files after you’ve deleted the JPG files.