Coder Social home page Coder Social logo

simple-archiver's Introduction

Simple Archiver

This small Groovy class is intended to pack your folders ignoring some files and sub-folders that you will add to exclusion list.

How to use

Below you find a small example of script that will pack entire directory /home/test/ skipping all the possible /.out sub-folders and the file /home/test/readme.txt.

It will produce a zip-file named 2020_02_20_result.zip where the date will be set according to the current date.

import java.text.SimpleDateFormat

SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy_MM_dd")
String targetZipFileName = dateFormat.format(new Date()) + "_result.zip"

SimpleArchiver archiver = new SimpleArchiver(
        "/home/test/",
        "/home/test/" + targetZipFileName)
archiver
        .setOutputFileName(true)
        .exclude("**/.out/**")
        .exclude("/home/test/readme.txt")
        .zip()

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.