'file zip/tar in linux at specific location

I want to zip a set of directories and files on my centos 8 VM. There are 3 directories and 1 file which I want to zip in such a way that only env.conf file will move to /etc/env.txt after unzipping it and remaining directories will be unzipped at current location. Is there any way to achieve this.

drwxr-xr-x. 9 root root       114 Feb 25 12:40 config
-rw-r--r--. 1 root root       340 Feb 25 09:01 env.conf
drwxr-xr-x. 9 root root      4096 Feb 28 05:11 platform
drwxr-xr-x. 2 root root       135 Feb 28 07:49 install


Solution 1:[1]

I don't think this is possible. in fact this is considered a vulnerability if you could do that.

Imagine you download a zip file from some website. and after you unzip it in a temp folder. It registers itself as a service by writing a file in /etc somewhere, and gets control over your pc. Example: zip-slip

You could however create a one-liner that extracts and moves the file wherever you want like this:

unzip <filename> && mv env.conf /etc/env.txt

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1