Zipping file

  • can i export file from dts in zip/ace/rar format?

  • I don't think you can directly export in a compressed format (hopefully someone will correct me if I am wrong) - but you can export the file, then use a cmdexec step to zip the file and delete the original. You will still need to have sufficient disk space for the full export though, and zip tool that can be accessed from the command line (Winzip works). Hope this helps.

  • How???

  • set @sourceFile = '\\networkname\filename.txt'

    set @archiveFile = '\\networkname\filename.zip'

    set @rar = '"C:\Program Files\WinRAR\rar.exe" a -df ' + @archiveFile + ' ' + @sourceFile

    set @sqlstate =

    'EXEC master.dbo.xp_cmdshell ''' + @rar + ''''

    exec (@sqlstate)

    Just one way to do it, using winrar as opposed to winzip. winzip will work much the same way, except you have to install the command line version of winzip. The help files of either winrar or winzip will give you the command line flags you need.

  • I recently tried to do something similar. I downloaded WZZIP the command line addon from http://www.winzip.com

    The documentation for WZZIP is included in a help file type wzzip /? at the DOS Command prompt.

    For example:

    CREATE PROCEDURE procZipFilePassword

    @IncomingFile varchar(255) = null,

    @Zipfile varchar(255) = null,

    @Password varchar(10) = null

    AS

    declare @cmdshell varchar(255)

    declare @Result int

    set @cmdshell = 'C:\Progra~1\WinZip\WZZIP.EXE -a -s' + @Password + ' '+ @zipfile + ' ' + @IncomingFile

    exec @Result = master..xp_cmdshell @cmdshell, NO_OUTPUT

    RETURN @Result

    GO

    To call above:

    Declare @ReturnValue int

    EXEC @ReturnValue = procZipFilePassword 'C:\Test\MyExcelFile.XLS','C:\Test\MyZipFile.zip', 'MyPassword'

    SELECT @ReturnValue as ReturnValue

  • Hi Thanks its working

  • What are you doing about licencing?

    I would love to use wzzip, but only if it can be built into our application. We do not want to administer winzip licences, when we sell a copy of our program.

    As far as I can figure out, you need to purchase a copy if you do not want to press "enter".

    Are there other alternatives?

    One would be to buy a zip library and then build a Delphi or VBB or ... program with it.

    But it would require us to install dll's and do other registration.

    How to get a program that does not require site licensing?

    Regards

    Henrik Staun Poulsen 

     

  • Take a look for freeware and shareware zip tools, especially the opensource dos ones.

    I use pkzip25, it works great, is fast.



    Shamless self promotion - read my blog http://sirsql.net

  • Thanks, but pkzip25 is not free? Is it possible to buy distribution rights?

    I've looked at CNET and found 11 free tools. but couldn't see if they have a command line interface.

     

  • Hi,

    I'm using "IZARC" (http://www.izsoft.dir.bg). The command line offers a limeted set of features (just Zip a file without encryption or password).

    The only problem is that it opens a window if the zip-file allready exists. So make sure, that the target file doesn`t exist.

    Or use a free programming library like SharZipLib (for .NET) an build your own little Zip-application if you need encryption.

    Regards,

    WiWo

     

     

  • Freeware Zip Util, dos based, so there is no install associated.... http://www.info-zip.org/pub/infozip/



    Shamless self promotion - read my blog http://sirsql.net

Viewing 11 posts - 1 through 10 (of 10 total)

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