Monday, 20 August 2012


Whenever I take any new project, I always require my Utilities library which provides me following features:

  1. Copying my library from dependency to  C Drive or  user's home directory in windows or *nix systems
  2. Compressing/Decompressing any Images or files for uploading or transferring it over network
  3. Getting extension of any file name in faster way
All this features can be achieved using just one library, and using this library is dam easy...even you can attach a listener to listen the processing i.e.
  • Name, count, size, compression level, copying from & copying to path of the file which library is processing ..

To attach a listener use this code

import fileutilslibrary.CopyEvent;
import fileutilslibrary.FileUtils;
import fileutilslibrary.Listener;
import fileutilslibrary.ZipEvent;
import java.util.logging.Level;
import java.util.logging.Logger;

 * @author Naved Momin<>
public class Demo2 implements Listener{

    void start( ) throws IOException{
        FileUtils.zipMyFolder(new File("C:\\Users\\Admin\\Desktop\\imgToVideo/RemoteDesktop"),
                  new File("C:/Users/Admin/Desktop/HMS Latest/"),9);

    public static void main(String[] args) {
        try {
            // TODO code application logic here
            new Demo2().start();
        } catch (IOException ex) {
            Logger.getLogger(Demo2.class.getName()).log(Level.SEVERE, null, ex);

    public void copyListener(CopyEvent e) {
        //notification about copying event

    public void zipListener(ZipEvent e) {
        //notification about zip event
        System.out.println( "name " +e.getZipingFileName() +  "\n" + "size " + e.getZipingFileSize() + "\n" +
        " count " + e.getFileCount( ) + "\n" +
        "level  " + e.getCompressionLevel() );

Various Methods:-

Copy a Directory

FileUtils.copyDirectory(src, dest);

Copy a File

FileUtils.copyFile(src, dest);

Zip Directory 

FileUtils.zipMyFolder(src, dest);

Zip Directory With Custom Compression Level

FileUtils.zipMyFolder(src, dest, compressionLevel);

Note: Compression level must be between 0-9, by default 0 is used

Zip File

FileUtils.zipMyFile(src, dest);

Zip File With Custom Compression Level

FileUtils.zipMyFile(src, dest, compressionLevel);

Note: Compression level must be between 0-9, by default 0 is used

UnZip File

FileUtils.doUnZip(src, dest);

Get File Extension (10x faster)


Reverse a String


Get File Name 


Note: The library is written in pure Java code except the Wallpaper class which throws NotSupportedOSException if OS is not supported by the library for more information see Javadoc included in the download package.
This library is totally compatible with various 3rd party zip utilities like winrar, which means you can zip your files programmatically and still use winrar for unzip'ing the file or vice-versa is also possible. 

For any bug or suggestions mail me at

This Library is License under GNU General Public License

Download latest builds