I need to zip a file on a share such as \\Share\Directory$\BIGexcelfile.xls I see alot of info that sterrs us to using a 2rd pary zip via a command line or something. But in a large organization I need to stick to using native windows compression as it is a server I have no control over - does anyone have an example using the native windows compression - and Uh - MS - Hello - was this an oversight - did you not think about this before 2011? Why is this not a Task in SSIS using native tools?
If using only microsoft technology is a firm requirement, you can add an execute process task to call the [compact] command. This would compress it in the file system, but I doubt it would remain compressed if you were to ftp or email it. Something to roll it up into a zip archive would really be the way to go. :
Here is a little bit of code that I use to zip up data using the native windows compression tool. "compress files and folders" I just execute this in a SQL job using the type "Active X Script" and use VBScript as the Language. The comments in the code should be pretty self explanatory for changing what you are zipping up and where you want to place it. 'Create the Shell.Application object Dim oShellApp, oFSO, oWScript Set oShellApp = CreateObject("Shell.Application") 'Create the File System object SET oFSO = CreateObject("Scripting.FileSystemObject") DIM sZipFile sZipFile = "C:\WORK\ZIPTEST\ZIPTHIS.zip" sTargetFolder = "C:\WORK\ZIPTEST\ZIPTHIS" oFSO.CreateTextFile sZipFile, True '.Write "PK" & Chr(5) & Chr(6) & String(18, vbNullChar) oShellApp.NameSpace(sZipFile).CopyHere oShellApp.NameSpace(sTargetFolder).Items(),1556 SET oShellApp = nothing SET oFSO = nothing