хочу заархивировать папку и разархивировать без родительского каталога, не произошло в ubunto

у меня есть папка и файл, подобный этому

x (folder)

x имеет 2 файла

a.py и y.py

, теперь я создаю zip с этим команда

cd /home/x/

ls

a.py и y.py

sudo zip -r ./zi.zip .

создает zip

zi.zip

, когда я извлекаю это, тогда он дает папку «zi» и в этой папке «a.py» и « y.py "

, но я не хочу папку zi

Я хочу, чтобы когда бы я ни извлекал эту папку, она дает мне a.py и y.py, а не папку

0
задан 8 July 2020 в 14:50

1 ответ

I am assuming you are extracting the archive using a graphical tool, as file-roller.

Using the terminal for both compressing and extracting, you get the following:

ls
a.py  y.py

zip -r ./zi.zip .
  adding: y.py (stored 0%)
  adding: a.py (stored 0%)

unzip zi.zip 
Archive:  zi.zip
replace y.py? [y]es, [n]o, [A]ll, [N]one, [r]ename: y
 extracting: y.py                    
replace a.py? [y]es, [n]o, [A]ll, [N]one, [r]ename: y
 extracting: a.py

ls
a.py  y.py  zi.zip

so the files are extracted to the same directory where you are.

The simplest solution would be to open the archive using file-roller and, after clicking on "Extract", deselecting the "Keep directory structure" flag. In this way the files are extracted in the current folder.

Note: this causes to lose all the structure of the archive, so if there were multiple directories, they will be lost.

Hope it helps.

0
ответ дан 30 July 2020 в 22:11

Другие вопросы по тегам:

Похожие вопросы: