51 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			Markdown
		
	
	
	
	
	
			
		
		
	
	
			51 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			Markdown
		
	
	
	
	
	
| # packer
 | |
| 
 | |
| A simple CLI tool to find and zip file corresponding to a given regex.
 | |
| 
 | |
| **NOTE**: if you have experience using Linux bash command, use `find` + `zip` command.
 | |
| 
 | |
| ## Installation
 | |
| 
 | |
| * Clone the repository
 | |
| ```bash
 | |
| git clone https://gitea.thegux.fr/rmanach/packer
 | |
| ```
 | |
| 
 | |
| * Build the binary
 | |
| ```bash
 | |
| make build
 | |
| ```
 | |
| 
 | |
| ## Usage
 | |
| ```bash
 | |
| # help
 | |
| ./packer -h
 | |
| ```
 | |
| ```
 | |
| usage: packer [-h|--help] -r|--regex "<value>" -o|--output-path "<value>"
 | |
|               [-d|--directory "<value>"] [-x|--remove]
 | |
| 
 | |
|               zip files where filenames match a regex
 | |
| 
 | |
| Arguments:
 | |
| 
 | |
|   -h  --help         Print help information
 | |
|   -r  --regex        filename Regex
 | |
|   -o  --output-path  zip output path (including zip name)
 | |
|   -d  --directory    root directory to check files. Default: .
 | |
|   -x  --remove       remove files after archive creation. Default: false
 | |
| ```
 | |
| 
 | |
| ```bash
 | |
| # template usage
 | |
| ./packer -r <regex> -o <output_path>
 | |
| 
 | |
| # zip '.log' files located in '/root/logs' directory
 | |
| # 'root_log.zip' will be created in the current directory
 | |
| ./packer -r ^.*\.log$ -d /root/logs -o root_logs.zip
 | |
| 
 | |
| # zip '.doc' files located in the current directory
 | |
| # the zip archive will be created in '/home/tutu/doc/'
 | |
| # all '.doc' files will be removed after successful zip
 | |
| ./packer -r ^.*\.doc$ -o /home/tutu/doc/root_log.zip -x
 | |
| ``` |