Zip: Difference between revisions

From Chorke Wiki
Jump to navigation Jump to search
No edit summary
Line 26: Line 26:
==DateTime Format==
==DateTime Format==
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
echo "$(date +'D%Y%m%d-T%H%M')-Z$(date +'%z'|tr '+-' 'PM')"
echo     "$(TZ=UTC-8 date +'%Y-%m-%dT%H%M')"
echo            "$(TZ=UTC-8 date +'%FT%H%M')"
BKP_DATE_N_TIME="$(TZ=UTC-8 date +'%FT%H%M')"
:'
:'
D20240628-T2023-ZP0800
2025-10-10T1010
├─ D20240628
├─ 2025-10-21
│  ├─ D    « Date
│  ├─ 2025 « %Y
│  ├─ 2024 « %Y
│  ├─  10 « %m
│  ├─ 06   « %m
│  └─  10 « %d
│  └─ 28   « %d
└─ T1010
├─ -T2023
  ├─    T « Time
│  ├─ -   « -
  ├─  10 « %H
│  ├─ T   « Time
  └─  10 « %M
│  ├─ 20   « %H
│  └─ 23   « %M
└─ -ZP0800
  ├─ -    « -
  ├─ Z    « Zone
  ├─ P    « {P: Plus (+), M:Minus (-)}
  └─ 0800 « Time Offset
'
'
</syntaxhighlight>
</syntaxhighlight>

Revision as of 13:36, 21 October 2025

sudo apt -qq update
sudo apt install -y zip unzip
unzip -V
zip -V

Compress

cd /etc/nginx
zip -r chorke-nginx_academia-production-D20240628-T2023-ZP0800.zip sites-enabled
zip -r chorke-nginx_academia-production-D20240628-T2023-ZP0800.zip sites-enabled -x default

Decompress

unzip -l chorke-nginx_academia-production-D20240628-T2023-ZP0800.zip
unzip    chorke-nginx_academia-production-D20240628-T2023-ZP0800.zip
unzip    chorke-nginx_academia-production-D20240628-T2023-ZP0800.zip -d chorke-nginx-academia-production

Explanation

-r: Recursive child folder
-x: Exclude file from the archive
-l: List the contents of the archive
-f: Specifies the name of the archive

DateTime Format

echo      "$(TZ=UTC-8 date +'%Y-%m-%dT%H%M')"
echo            "$(TZ=UTC-8 date +'%FT%H%M')"
BKP_DATE_N_TIME="$(TZ=UTC-8 date +'%FT%H%M')"
:'
2025-10-10T1010
├─ 2025-10-21
│  ├─ 2025 « %Y
│  ├─   10 « %m
│  └─   10 « %d
└─ T1010
   ├─    T « Time
   ├─   10 « %H
   └─   10 « %M
'

References