Discussion
Pegasystems Inc.
US
Last activity: 28 Nov 2018 9:51 EST
Zip File Demo
Here is a demo project to show how to use the SharpLib dll which is installed with the product to zip a folder or zip a file. There is also an automation to find the current RuntimeLog and zip it up. This was built in 8.0.1076 and requires at least 8.0.1053 to open.
-
Reply
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Pegasystems Inc.
IN
Thank you Jeff, for sharing this on PSC.
Cigna Health Solutions India Pvt Ltd
IN
Hi Jeff,
We can use this below simple script to Zip a folder with Password Protected. Just we need to add Ionic.zip dll to the references. And it is Working fine for me. Try This.https://www.dllme.com/dll/files/ionic_zip_dll.html
using System;
using System.Collections;
using System.Data;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Windows.Forms;
using System.Xml;
//using System.IO.Compression;
using Ionic.Zip;
namespace Dynamic.Script_8D58822E2C26581
{
// Script generated by Pega Robotics Studio 8.0.1063.0
// Please use caution when modifying class name, namespace or attributes
[OpenSpan.TypeManagement.DynamicTypeAttribute()]
[OpenSpan.Design.ComponentIdentityAttribute("Script-8D58822E2C26581")]
public sealed class Script
{
public void NewMethod1(string inputpath,string outputPath)
{
using (ZipFile zip = new ZipFile())
{
zip.Password = "password";
zip.AddDirectory(inputpath);
zip.Save(outputPath);
}
}
}
}
Mphasis Unleash the Next
IN
Hi Micky,
I tried with your script and dll, but working out getting error like "Message: "Error executing link in Automation: Zop_Auto - From: OpenSpan.Runtime.RuntimeHost.ProjectStarted To: Global_Container1.script1.NewMethod1()"
Passing paths as:
Inputpath:C:\Users\gururaju\Desktop\test\txttest (This folder has ont .txt file)
oputputpath: C:\Users\gururaju\Desktop
Note: I tried with following also Inputpath:C:\Users\gururaju\Desktop\test
can you share screen shots of your code automation and code contains in script component???
Pegasystems Inc.
US
There are certainly lots of ways to do this :) and thanks for sharing. Sharplib is already included with the product, hence the reason why I presented this solution. This is not new info - there was a post over a year ago with similar information. At the time we couldn't actually post solutions to PSC so now that we can I thought it would be good to add one for anyone who might want to use it to get a head start.
Mphasis Unleash the Next
IN
Hi Jeff,
I tried with your solution but not working but getting error when i run the solution.
Please tell me inputs for the automation
I have given inputs as below, please tell me the procedure if i did wrong,
1. Folder to Zip: C:\Users\gururaju\Desktop\test
2. Zip Password: test123
3. Zip File Name: C:\Users\gururaju\Desktop\testzip (i tried with just zipname as testzip)
Westpac Banking Corporation
AU
Try by passing zip file name with extension ex: testzip.zip
Mphasis Unleash the Next
IN
Thank you JayaChandra. It's working.
And Thanks you Jeff...
None
LK
Thanks Jeff
Its working fine.
I was in need to zip files inside a folder.