Forum Discussion

Nikpowar97's avatar
Nikpowar97
Contributor
3 years ago

Pick a .csv file stored in the DM Export in Filestore and covert to a .zip file

I am storing a csv file in everyone path in filestore> Data Managemanet>Export> User folder. I want an BR that reads the file and compress (Create new .zip/ Override the .csv to .zip) and store in the same path. I am facing issues in same.

  • Never done it myself but a quick googling and StackOverflowing shows you should be able to use the libraries System.IO.Compression.Filesystem and System.IO.Compression, which have a ZipFile class. You might have to reference the necessary DLLs in the rule properties though.

  • JackLacava's avatar
    JackLacava
    Honored Contributor

    Never done it myself but a quick googling and StackOverflowing shows you should be able to use the libraries System.IO.Compression.Filesystem and System.IO.Compression, which have a ZipFile class. You might have to reference the necessary DLLs in the rule properties though.

    • Nikpowar97's avatar
      Nikpowar97
      Contributor

      Hi JackLacava ,

       

      You are correct we were missing the dlls  (XF\WinSCPnet.dll; C:\Windows\Microsoft.NET\Framework64\v4.0.30319\System.IO.Compression.dll; System.IO.Compression.FileSystem.dll) to include the Zip file class. We have used the library System.IO.Compression only. Zipfile class won't give you suggestions but will work as expected, 

      Dim ZipFileName As String = "Test.zip"
      Dim ZipFilePath As String = BRApi.FileSystem.GetFileShareFolder(si, FileShareFolderTypes.ApplicationRoot, Nothing) & "\" & si.AppName.Replace(" ", String.Empty) & "\Groups\" & ZipFileName

      ZipFile.CreateFromDirectory(exportFolderPath, ZipFilePath). this will store the the files under the folder path, exportFolderPath on the filepath, ZipFilePath.

  • Jarek_Sadowski's avatar
    Jarek_Sadowski
    New Contributor II

     

    Dim ZipFileName As String = "test.zip"
    
    Dim folderLocation  As String = FileShareFolderHelper.GetDataManagementExportUsernameFolderForApp(si, True, configSettings.FileShareRootFolder, si.AppName)
    
    Dim ZipFilePath As String = folderLocation & "\" & ZipFileName
    
    XFZip.Zip(ZipFilePath, folderLocation)​

     


    ZipFile is not working for me. I am working on OneStream on cloud. I think they do not have this library. But I found that they use their own method to zip files.

    This is the poorest documentation I have seen ever. I spent hours to find this.

     

    • JackLacava's avatar
      JackLacava
      Honored Contributor

      Hey Jarek, I'm sorry you had to suffer through this - we know documentation coverage is not where we'd like them to be, which is partially why this forum exists. Generally speaking, for anything related to "how do I do this thing in Cloud", feel free to chat with Support - chances are someone else had your problems before, and they are happy to make the necessary tweaks. As you can imagine, for security purposes, in Cloud a lot of stuff is not available until you tell us that you really really need it. This is probably one of them.

      • Jarek_Sadowski's avatar
        Jarek_Sadowski
        New Contributor II

        Hi Jack,

        I fully agree. I hope that this forum is going to grow. I can see you are doing a good job in aim to make it.