7 Zip blocking itself from accessing the zip file being created

  • I have a For Each Loop that contains a process task where Im calling 7 Zip to create a zip file which contains several txt files. Sometimes it runs fine but other times I get an error saying: "The process cannot access the file because it is being used by another process. cannot delete the file \\directory path\[the name of the zip file that its creating].

    Seems like the process tries to access the zip file before the the lock from the last execution of the foreach loop has been removed. Is there a way to ensure that this doesn't happen?

  • I think what you're seeing is Windows being slow at releasing control of the file. I've had similar problems with file system operations when looping very quickly through a list of files. In one package, I had to add a short wait (1-2 sec) in the loop to stop this from happening.

    One thing you could try, is, on error, wait 2 seconds, then try again.



    Alvin Ramard
    Memphis PASS Chapter[/url]

    All my SSC forum answers come with a money back guarantee. If you didn't like the answer then I'll gladly refund what you paid for it.

    For best practices on asking questions, please read the following article: Forum Etiquette: How to post data/code on a forum to get the best help[/url]

  • Added an Exe sql task with WAITFOR DELAY '00:00:02'; in the foreach loop before the exe process task calling 7 zip but still getting error

  • dndaughtery (2/5/2016)


    I have a For Each Loop that contains a process task where Im calling 7 Zip to create a zip file which contains several txt files. Sometimes it runs fine but other times I get an error saying: "The process cannot access the file because it is being used by another process. cannot delete the file \\directory path\[the name of the zip file that its creating].

    Seems like the process tries to access the zip file before the the lock from the last execution of the foreach loop has been removed. Is there a way to ensure that this doesn't happen?

    I've read this three or four times and I don't understand what's going on.

    If you are creating a Zip file, why would you ever get a 'cannot delete' type error?

    If your FEL contains the EP task, the EP task is executed on every iteration of the FEL. Yet you refer only to the 'last execution of the FEL'. Why are you calling the EP task repeatedly?

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.

  • I have several files in the folder that need to be zipped into the same zip file

  • dndaughtery (2/8/2016)


    I have several files in the folder that need to be zipped into the same zip file

    OK, but this does not answer my questions.

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply