Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Hello

In the SM sample file exists an Unzip module requiring to choose the zip file ; the file is expanded in a folder named as the original file

Has someone adapted this module in the idea of unzipFile(filesource ; folderDestination)

Thanks for links

Noël

Edited by Noél Dubau

hello dear Noël 😊
yes, easy with two parameters sourcePath and destPath :

Quote

import java.util.zip.*;
import java.io.*;
import java.util.*;

if(sourcePath == null || sourcePath.equals("") || destPath == null || destPath.equals("")) {
    return 'Les paramètres sourcePath et destPath doivent être renseignés'
}

/*
* Create directory with the name of the zip file
*
* For e.g. if we are going to extract c:/demo.zip create c:/demo
* directory where we can extract all the zip entries
*
*/
try {
    File fSourceZip = new File(sourcePath);
    String zipPath = destPath

    File temp = new File(zipPath);
    temp.mkdir();
    /*
    * Extract entries while creating required
    * sub-directories
    *
    */
    ZipFile zipFile = new ZipFile(fSourceZip);
    Enumeration e = zipFile.entries();

    while(e.hasMoreElements()) {
        ZipEntry entry = (ZipEntry)e.nextElement();
        File destinationFilePath = new File(zipPath,entry.getName());

        //create directories if required.
        destinationFilePath.getParentFile().mkdirs();

        //if the entry is directory, leave it. Otherwise extract it.
        if(entry.isDirectory()) {
            continue;
        }
        else {
            System.out.println("Extracting " + destinationFilePath);
        
            /*
            * Get the InputStream for current entry
            * of the zip file using
            *
            * InputStream getInputStream(Entry entry) method.
            */
            BufferedInputStream bis = new BufferedInputStream(zipFile.getInputStream(entry));

            int b;
            byte[] buffer = new byte[1024];

            /*
            * read the current entry from the zip file, extract it
            * and write the extracted file.
            */
            FileOutputStream fos = new FileOutputStream(destinationFilePath);
            BufferedOutputStream bos = new BufferedOutputStream(fos,1024);

            while ((b = bis.read(buffer, 0, 1024)) != -1) {
                bos.write(buffer, 0, b);
            }

            //flush the output stream and close it.
            bos.flush();
            bos.close();

            //close the input stream.
            bis.close();
        }
    }
    zipFile.close();
}
catch(IOException ioe) {
            return "IOError :" + ioe;
}

return 1;

 

  • Author

Thanks a lot my dear Eric ! I'll try it to morrow and I'm sur you'lll be one more time my savior !

have a good night !

Noël

PS : As you see I've a ot of problems with other modules ; I've saved my disk, reinstalled all apps ands extesions... but errors are still present ! Grrrr

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.