October 9, 2008 at 7:38 am
Hi guys,
I added an Execute Process Task to zip a file usnig winrar (or winzip) but the task is not workin well. The task looks successful (turns green) but the file is not generated..
These are the settings within the Execute Process Task:
Executable: C:\Program Files\WinRAR\rar.exe
Argument: rar -a C:\list.txt C:\MyCompressedfile.rar
WorkingDirectory: C:\
Any help is appreciated.
Thanks in advance
October 9, 2008 at 3:38 pm
Do you need "rar" in the arguments?
Russel Loski, MCSE Business Intelligence, Data Platform
October 13, 2008 at 3:52 am
Apparently yes. I tried executing the same file without the 'rar' in the Arguments and still no compressed file was generated..
Any more ideas?
October 13, 2008 at 7:08 am
What happens if you run the following:
"C:\Program Files\WinRAR\rar.exe" -a C:\list.txt C:\MyCompressedfile.rar
Russel Loski, MCSE Business Intelligence, Data Platform
October 14, 2008 at 1:53 am
I managed to get it working... The Arguments simply have to be set like this:
a c:\test.rar c:\list.txt
Thanks for your help 🙂
September 3, 2009 at 11:01 am
Hola amiguito, si quieres hacer comprimir tu archivo y crear uno con extension .ZIP, te paso un código CHINGON!
Usa un Script Task y escribe este código:
Option Strict Off
Imports System
Imports System.IO
Imports System.IO.Compression
Imports Microsoft.SqlServer.Dts.Runtime
Public Class ComprimirArchivo
Rem Variable that holds Path and File Name
Private archivo_txt As String = Path.Combine(Dts.Variables.Item("Ruta_Archivo").Value.ToString, Dts.Variables.Item("Nombre_Archivo").Value.ToString)
Public Sub Main()
Try
Using fsArchivo As New FileStream(Me.archivo_txt, FileMode.Open, FileAccess.Read, FileShare.Read)
Dim buffer(fsArchivo.Length) As Byte
Dim intCount = fsArchivo.Read(buffer, 0, buffer.Length)
fsArchivo.Close()
Using archivoZip As New FileStream(Me.archivo_txt + ".zip", FileMode.Create, FileAccess.Write)
Using compressor As New GZipStream(archivoZip, CompressionMode.Compress, True)
compressor.Write(buffer, 0, buffer.Length)
End Using
End Using
buffer = Nothing
intCount = Nothing
End Using
File.Delete(Me.archivo_txt)
Dts.TaskResult = Dts.Results.Success
Catch ex As Exception
Dts.Events.FireError(-1, "Comprimir Archivo: " + Me.archivo_txt, ex.Message, "", 0)
Dts.TaskResult = Dts.Results.Failure
Finally
Me.archivo_txt = Nothing
End Try
End Sub
End Class
October 3, 2011 at 4:21 am
HI,
Execute Process Task , you need to give some property false, i have mention below pleas try it.
left side , there is a process ..
in that what you need to modify is..
failtaskifreturnCodeIsNotSuccessValue make it False
it will work.
third party tools required to unzip or make zip
Thanks
G.Chinna Babu
09177848182
india
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply