boolean receiveDirectory(List<String> src, Path dest, final boolean zip, final boolean toplevel, DItem item, JFrame frame) 
            throws IOException, ClassNotFoundException, WrongVersionNumber{
        if ((src == null) || (dest == null) || (item == null)){
            return false;
        }
        boolean res = false;
        if (zip){
            res = receiveFile(dest, src, true, frame);
        } else {
            if (toplevel){
                Path dest2 = Paths.get(dest.toAbsolutePath().toString(), src.get(src.size()-1));
                Files.createDirectories(dest2);
                dest = dest2;
            }
            if (item.isDir()){
                DDirectory dir = (DDirectory) item;
                for (Map.Entry<String,DItem> entry : dir.getItemMap().entrySet()){
                    Path dest2 = Paths.get(dest.toAbsolutePath().toString(), entry.getKey());
                    List<String> src2 = new ArrayList<>();
                    src2.addAll(src);
                    src2.add(entry.getKey());                    
                    if(entry.getValue().isDir()){
                        // create the dir if needed                    
                        if (Files.notExists(dest2)){
                            Files.createDirectories(dest2);
                        }
                        // continue recursively in depth   
                        DItem item2 = entry.getValue();
                        receiveDirectory(src2, dest2, false, false, item2, frame);
                    } else {
                        // handle entry as a regular file
                        receiveFile(dest2, src2, false, frame);
                    }
                }
                res = true;
            }            
        }
        return res;
    }