Giter Club home page Giter Club logo

go_targz's Introduction

使用 golang 写的 tar.gz 压缩工具

实现如下功能

读取同级目录的 filter_config.json 配置文件,该 filter_config.json 是一个过滤条件,满足条件的都将过滤掉(包括子级目录下)

如没有此 json 文件,则压缩当前目录全部文件

如:okmes_,那么所有同级目录和子目录中,匹配上前缀的文件夹全部跳过压缩, 取当前所在目录的文件夹名称作为压缩包名称,将同级,子级所有文件和文件夹都压缩成tar.gz

使用须知

输入 go_targz.exe help 将输出以下说明

1.将该程序放到需要打包的目录下 2.在目录创建一个 filter_config.json 文件,按需填入过滤的相关内容,

{
    "dir": [],
    "files": [],
    "file_prex": [],
    "file_suffix":[],
    "dir_prex": [],
    "dir_suffix":[]
}

字段解释:

  • dir 需要过滤的目录,如: ["my_img","static"]
  • files 需要过滤的文件完整名称,如:["main.go", "xxx.text"]
  • file_pres 需要过滤的文件前缀,如:["img_", "aaa.fff"]
  • file_suffix 需要过滤的文件后缀,如:[".go", ".txt"]
  • dir_prex 需要过滤的目录前缀,如:["imgs_"]
  • dir_suffix 需要过滤的目录后缀,如:["_docs"]

3.然后双击执行该程序,会在当前目录生成一个以当前目录为前缀-时间戳的新 .tar.gz 文件

按需下载

go build -o go_targz_win.exe main.go

windows 使用 go_targz_win.exe

set GOOS=darwin
set GOARCH=amd64
go build -o go_targz_mac main.go

mac 使用 go_targz_mac

set GOARCH=amd64
set GOOS=linux
go build -o go_targz_linux main.go

linux 使用 go_targz_linux

go_targz's People

Contributors

ituserxxx avatar

Watchers

 avatar

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.