Checking Integrity of a zip file

  • HI

    I'm having issues with unzipping files via xp_cmdshell and bulk inserting into a table. Occasionally these zip files have CRC errors, and this causes havoc when inserting to the table. I know I am able to test the zip file with the following command...

    DECLARE @DirCommand varchar (200)

    SET @DirCommand = '"c:\program files\winzip\wzunzip.exe" -t C:\test\zipfile'

    EXEC master.dbo.xp_cmdshell @Dircommand

    ... but am not sure how to capture the results. If possible, I need to be able to capture an error, so I can log which file was corrupt.

    Has anyone done this before?

    Thanks in advance,

    Brad

  • brad (10/29/2008)


    HI

    I'm having issues with unzipping files via xp_cmdshell and bulk inserting into a table. Occasionally these zip files have CRC errors, and this causes havoc when inserting to the table. I know I am able to test the zip file with the following command...

    DECLARE @DirCommand varchar (200)

    SET @DirCommand = '"c:\program files\winzip\wzunzip.exe" -t C:\test\zipfile'

    EXEC master.dbo.xp_cmdshell @Dircommand

    ... but am not sure how to capture the results. If possible, I need to be able to capture an error, so I can log which file was corrupt.

    Has anyone done this before?

    Thanks in advance,

    Brad

    Have you considered SSIS as an alternative? You could handle exceptions much better within .NET using a script task (http://www.sqlservercentral.com/Forums/Topic466237-148-1.aspx)

Viewing 2 posts - 1 through 2 (of 2 total)

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