Skip to content

Commit d23fe6d

Browse files
committed
refactor: zip work flow
1 parent 296a204 commit d23fe6d

1 file changed

Lines changed: 13 additions & 7 deletions

File tree

specs/zip/compress_subdirectories_under_folder.yaml

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,26 @@
11
---
2-
name: Use zip to compress all subdirectories under a folder and output each directory as a zip file.
3-
command: "for dir in $(ls -d {{directory}}*/); do (zip -r -q {{output}}$(basename $dir){{zip_name_endwith}}.zip $dir && echo -e \"Compressed to {{output}}$(basename $dir){{zip_name_endwith}}.zip.\"); done"
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"
44
tags:
55
- zip
66
description: Use zip to compress all subdirectories under a folder and output each directory as a zip file.
77
arguments:
88
- name: directory
9-
description: The directory to execute.
9+
description: Optional, The directory to execute. default is current directory.
1010
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: '*'
1117
- name: output
12-
description: The output directory of the zip file. Optional, defaults to the current directory.
18+
description: Optional, The output directory of the zip files. default is the current directory.
1319
default_value: ./
14-
- name: zip_name_endwith
15-
description: Endwith string of each zip file name Optional, the default time string.
20+
- name: name_with_str
21+
description: Optional, Endwith string of each zip file name. default is now time string.
1622
default_value: _$(date +%Y%m%d%H%M%S)
17-
source_url: "https://linuxhint.com/what-is-zip-file/"
23+
source_url: "https://www.geeksforgeeks.org/zip-command-in-linux-with-examples/"
1824
author: funnyzak
1925
author_url: "https://github.com/funnyzak"
2026
shells:

0 commit comments

Comments
 (0)