Problem with my code - To zip a folder using stored procedure

  • Hi,

    I wrote a code to zip my folder. But apparently the code takes forever to RUN and after its done, i see bunch of junk data stored along with my files. What is going wrong? Could anyone help.

    Declare @job Varchar(50)

    Declare @ret int

    begin

    set @job = 'wzzip -ys4700000 C:\document.zip "' + '"'

    print @job

    exec @ret = master..xp_cmdshell @job

    if @ret = 0

    print 'success'

    else

    print 'fail'

    print @job

    end

    end

  • Hi Rama,

    The syntax for wzzip is the following

    1- wzzip [options] zipfile [@listfile] [files...]

    For example wzzip -a c:\test.zip c:\*.txt

    2- You use

    set @job = 'wzzip -ys4700000 C:\document.zip "' + '"'

    -ys4700000 means splits zip files each zip is 4700000 KB it means each one has 4.48 gig

    and -ys is used to split an existing zip.

    From wzzip Help

    -ys

    Split an existing Zip file into separate files of a specified size.

    The name of each separate file will be based on the name used for

    the destination file name (parameter "zipfile" shown in example at beginning of this page).

    The size is the number of KBs for each file.

    If the size is omitted, the function is similar to the span option and the destination file name must be on a removable disk.

    Each removable disk except for the first will have any files deleted from it before the spanned Zip file is written.

    For more information see Splitting Zip Files.

    wzzip -ys1024 f:\examples\large.zip f:\testing\split

    Split the Zip file large into 1024KB sections called Split (split.z01, split.z02, etc. split.zip).

    Regards,

    Ahmed

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

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