Digital Exchange

 View Only
last person joined: 6 days ago 

This community is a place to discuss Blue Prism DX assets and development.

  • 1.  Illegal characters in ZIP

    Posted 05-25-2022 11:58

    Greetings,

    Is there any way to rename files in ZIP ? 

    When we tried to extract from ZIP to Folder we get an error msg : Could not execute code stage because exception thrown by code stage: Illegal characters in path.

    Later we found the file, the filename started with the "_" character. Or how can i extract files with special characters in file name? 

    One more thing, when we extract from ZIP manually there is no problem, but when with BP it's throwing error msg. Or when the BP successfully extract from ZIP , we get file names like "cn� spr�" ,the original name was "cná sprá". 



    ------------------------------
    Peter Vígh
    ------------------------------



  • 2.  RE: Illegal characters in ZIP

    Posted 05-25-2022 14:47
    Hello Peter,

    Which Utility are you using to unzip files?

    ------------------------------
    If I was of assistance, please vote for it to be the "Best Answer".

    Thanks & Regards,
    Tejaskumar Darji
    Sr. Consultant-Technical Lead
    ------------------------------



  • 3.  RE: Illegal characters in ZIP

    Posted 05-25-2022 15:01
    Hi Peter,

    I checked the same from the latest DX Exchange asset and it seems to work properly for me but with those special characters which you mentioned:



    Try downloading the latest asset from here:  Windows Compressed File

    ------------------------------
    ----------------------------------
    Hope it helps you out and if my solution resolves your query, then please mark it as the 'Best Answer' so that the others members in the community having similar problem statement can track the answer easily in future

    Regards,
    Devneet Mohanty
    Intelligent Process Automation Consultant | Sr. Consultant - Automation Developer,
    WonderBotz India Pvt. Ltd.
    Blue Prism Community MVP | Blue Prism 7x Certified Professional
    Website: https://devneet.github.io/
    Email: devneetmohanty07@gmail.com

    ----------------------------------
    ------------------------------



  • 4.  RE: Illegal characters in ZIP

    Posted 05-26-2022 11:32

    Hello guys,

    I tried the updated version of the Windows Compressed File utility, still have the same issue.

    So the file name is : _fileName.docx - still getting the same error msg.
    Is there any way to change the file name in ZIP? 

    Thank you.



    ------------------------------
    Peter Vígh
    ------------------------------



  • 5.  RE: Illegal characters in ZIP
    Best Answer

    Posted 05-30-2022 01:22
    Hi Peter,

    Sorry for the late reply as I got occupied with some of my personal errands for last few days. As per your requirement, if I am correct you are looking for a way to rename the file entries within the zip file even before extracting the data onto a folder. If that is the requirement, then I think the current utility which Blue Prism has can't be used as 'Utility - Windows Compressed File' uses 'System.IO.Compression' namespace which can't allow to make any changes to the entry names as they are of read only type.

    However, you can use the 'DotNetZip' package which can be installed/downloaded from the following Nuget package location: DotNetZip Nuget Package  and copy the highlighted file into Blue Prism installation folder as shown below:





    This DLL internally uses 'System.IO.Compression' and 'Ionic.Zip' utilities. In order to now use it inside Blue Prism, you can create a new object and give it a suitable name. In my case the name of the object is 'Utility - Windows Compressed File Extended' and in the 'Initialise' page, under page description stage you need to add the following 'External References' : DotNetZip.dll and the following 'Namespace Import': Ionic.Zip. Also, ensure that the language chosen is 'Visual Basic' as shown below:


    Now, add a new action called as 'Rename Zip Entries' and add the below input and output parameters:

    Input Parameters:

    - Zip File Path (Text) : The file path of the zip file where the modification to the entries need to be performed.

    - Entry Names (Collection) : The entry names collection consisting of the original names and the modified names.
          - Original Name (Text) : This field consists of the original name of the file entry inside the zip archive which you want to rename.
          - Modified Name (Text) : This field consists of the name to which the file entry inside the zip archive needs to be renamed into.

    Output Parameters:

    - Message (Text) : The message text displaying any file entries not being found in the zip archive.


    Now, add a code stage called 'Rename Zip Entries' with the below parameters:



    Code:



    Dim zipFile As ZipFile = ZipFile.Read(Zip_File_Path)
    Dim entryExists As Boolean
    
    
    For Each row As System.Data.DataRow In Entry_Names.Rows
    
    	entryExists = False
    
    	For i = 0 To zipFile.Count-1
    
    		If zipFile(i).FileName.Equals(CStr(row("Original Name"))) Then
    	
    			zipFile(i).FileName = CStr(row("Modified Name"))
    			entryExists = True
    			Exit For		
    		
    		End If
    
    	Next
    
    	'Validate if the entry was not found in the zip file
    
    	If entryExists = False Then
    	
    		If Message.Equals(String.Empty) Then
    		
    			Message = "The current zip entry does not exists in the provided zip file path: " + Environment.NewLine() + Environment.NewLine() + CStr(row("Original Name"))
    
    		Else
    
    			Message = Message + Environment.NewLine() + CStr(row("Original Name"))
    
    		End If
    
    	End If
    
    Next
    
    
    zipFile.Comment = "This archive has been modified at the following date: " + Now.ToString()
    zipFile.Save()

    Now, you can publish the action and test it from Process Studio. For my test scenario, I have take the below zip file which consists of two file entries - 'Input.xlsx' and 'Split Columns From Excel.bprelease' :






    Now, my input zip file path parameter will have the file path of this zip file whereas the entry names collection parameter will have three entries out of which two rows consists of the valid file names which are available within my zip file and the last row consists of an invalid file entry that does not exists within my zip file as shown below:



    Now, once I execute the workflow below output is what I get:


    For the last entry, I got the error message in my message output as it does not exists, however for the other two entries my zip archive looks as below now:



    This action will help you to rename any file entry within a specified zip file as long as you provide the correct file entry name and the name that needs to be used for renaming the file entry in the proper format as shown above.
    ------------------------------
    ----------------------------------
    Hope it helps you out and if my solution resolves your query, then please mark it as the 'Best Answer' so that the others members in the community having similar problem statement can track the answer easily in future

    Regards,
    Devneet Mohanty
    Intelligent Process Automation Consultant | Sr. Consultant - Automation Developer,
    WonderBotz India Pvt. Ltd.
    Blue Prism Community MVP | Blue Prism 7x Certified Professional
    Website: https://devneet.github.io/
    Email: devneetmohanty07@gmail.com

    ----------------------------------
    ------------------------------



Welcome to the Blue Prism Digital Exchange Community!

The Blue Prism Digital Exchange is a "shop window" for new and emerging technologies—a platform that puts powerful RPA and AI capabilities into the hands of business leaders. Users can find and apply pre-built AI capabilities, in the form of downloadable integrations and Visual Business Objects (VBOs), to automated processes. These assets connect and integrate Digital Workers, existing systems and processes to Blue Prism's technology partners, creating a solid foundation of AI-enabled Intelligent Automation that's scalable and sustainable.

Blue Prism Digital ExchangeDX Asset IdeasContact DX Support

FAQs

The Blue Prism Digital Exchange (DX) is an online marketplace where businesses can instantly access, apply and share pre-built AI, cognitive and advanced RPA technologies from best-in-class providers. These assets easily connect to existing digital workers, systems and processes to enhance automation capabilities.
The Digital Exchange is free to all users. Most of the content on the DX is free to download but there are some submissions that do have a cost associated. The submissions with a cost are advertised on the asset card and profile. No unwanted costs will be applied to any users.
You can visit and browse the Digital Exchange here. If you would like to consume or download any material it is necessary to create an account on the Blue Prism Portal first.
Everyone can access the Digital Exchange and consume the assets on it. If you would like to contribute to the marketplace it is necessary that you create an account and sign up as a partner.