Skip to content

Commit 9f5f20e

Browse files
authored
Merge pull request #117 from funnyzak/main
Add compress subdirectories under folder workflow
2 parents 941fcd7 + 7d4f3ef commit 9f5f20e

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
name: Compression all subdirectories and output each directory as a zip file.
3+
command: "for dir in $(ls -d {{directory}}*/); do (zip -r {{opitons}} {{output}}$(basename $dir){{name_with_str}}.zip ${dir}{{zip_pattern}} && echo -e \"Compressed to {{output}}$(basename $dir){{name_with_str}}.zip.\"); done"
4+
tags:
5+
- zip
6+
description: Use zip to compress all subdirectories under a folder and output each directory as a zip file.
7+
arguments:
8+
- name: directory
9+
description: Optional, The directory to execute. default is current directory.
10+
default_value: ./
11+
- name: opitons
12+
description: Optional, The options of zip command.
13+
default_value: -q
14+
- name: zip_pattern
15+
description: Optional, The pattern of match the files under each subdirectory to be compressed.
16+
default_value: '*'
17+
- name: output
18+
description: Optional, The output directory of the zip files. default is the current directory.
19+
default_value: ./
20+
- name: name_with_str
21+
description: Optional, Endwith string of each zip file name. default is now time string.
22+
default_value: _$(date +%Y%m%d%H%M%S)
23+
source_url: "https://www.geeksforgeeks.org/zip-command-in-linux-with-examples/"
24+
author: funnyzak
25+
author_url: "https://github.com/funnyzak"
26+
shells:
27+
- Bash

0 commit comments

Comments
 (0)