diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..7c1c94c Binary files /dev/null and b/.DS_Store differ diff --git a/aula186.py b/aula186.py index 9a0d222..2180b0e 100644 --- a/aula186.py +++ b/aula186.py @@ -29,3 +29,19 @@ def criar_arquivos(qtd: int, zip_dir: Path): criar_arquivos(10, CAMINHO_ZIP_DIR) + +# Criando um zip e adicionando arquivos +with ZipFile(CAMINHO_COMPACTADO, 'w') as zip: + for root, dirs, files in os.walk(CAMINHO_ZIP_DIR): + for file in files: + # print(file) + zip.write(os.path.join(root, file), file) + +# Lendo arquivos de um zip +with ZipFile(CAMINHO_COMPACTADO, 'r') as zip: + for arquivo in zip.namelist(): + print(arquivo) + +# Extraindo arquivos de um zip +with ZipFile(CAMINHO_COMPACTADO, 'r') as zip: + zip.extractall(CAMINHO_DESCOMPACTADO) diff --git a/aula186_compactado.zip b/aula186_compactado.zip new file mode 100644 index 0000000..9f8e361 Binary files /dev/null and b/aula186_compactado.zip differ diff --git a/aula186_descompactado/arquivo_0.txt b/aula186_descompactado/arquivo_0.txt new file mode 100644 index 0000000..e7377f5 --- /dev/null +++ b/aula186_descompactado/arquivo_0.txt @@ -0,0 +1 @@ +arquivo_0 \ No newline at end of file diff --git a/aula186_descompactado/arquivo_1.txt b/aula186_descompactado/arquivo_1.txt new file mode 100644 index 0000000..9741e29 --- /dev/null +++ b/aula186_descompactado/arquivo_1.txt @@ -0,0 +1 @@ +arquivo_1 \ No newline at end of file diff --git a/aula186_descompactado/arquivo_2.txt b/aula186_descompactado/arquivo_2.txt new file mode 100644 index 0000000..db8d396 --- /dev/null +++ b/aula186_descompactado/arquivo_2.txt @@ -0,0 +1 @@ +arquivo_2 \ No newline at end of file diff --git a/aula186_descompactado/arquivo_3.txt b/aula186_descompactado/arquivo_3.txt new file mode 100644 index 0000000..413cd2e --- /dev/null +++ b/aula186_descompactado/arquivo_3.txt @@ -0,0 +1 @@ +arquivo_3 \ No newline at end of file diff --git a/aula186_descompactado/arquivo_4.txt b/aula186_descompactado/arquivo_4.txt new file mode 100644 index 0000000..ed70dc0 --- /dev/null +++ b/aula186_descompactado/arquivo_4.txt @@ -0,0 +1 @@ +arquivo_4 \ No newline at end of file diff --git a/aula186_descompactado/arquivo_5.txt b/aula186_descompactado/arquivo_5.txt new file mode 100644 index 0000000..380c50d --- /dev/null +++ b/aula186_descompactado/arquivo_5.txt @@ -0,0 +1 @@ +arquivo_5 \ No newline at end of file diff --git a/aula186_descompactado/arquivo_6.txt b/aula186_descompactado/arquivo_6.txt new file mode 100644 index 0000000..d3437a6 --- /dev/null +++ b/aula186_descompactado/arquivo_6.txt @@ -0,0 +1 @@ +arquivo_6 \ No newline at end of file diff --git a/aula186_descompactado/arquivo_7.txt b/aula186_descompactado/arquivo_7.txt new file mode 100644 index 0000000..1101b85 --- /dev/null +++ b/aula186_descompactado/arquivo_7.txt @@ -0,0 +1 @@ +arquivo_7 \ No newline at end of file diff --git a/aula186_descompactado/arquivo_8.txt b/aula186_descompactado/arquivo_8.txt new file mode 100644 index 0000000..449ab27 --- /dev/null +++ b/aula186_descompactado/arquivo_8.txt @@ -0,0 +1 @@ +arquivo_8 \ No newline at end of file diff --git a/aula186_descompactado/arquivo_9.txt b/aula186_descompactado/arquivo_9.txt new file mode 100644 index 0000000..4ef1d0f --- /dev/null +++ b/aula186_descompactado/arquivo_9.txt @@ -0,0 +1 @@ +arquivo_9 \ No newline at end of file diff --git a/aula_186_diretorio_zip/arquivo_0.txt b/aula_186_diretorio_zip/arquivo_0.txt new file mode 100644 index 0000000..e7377f5 --- /dev/null +++ b/aula_186_diretorio_zip/arquivo_0.txt @@ -0,0 +1 @@ +arquivo_0 \ No newline at end of file diff --git a/aula_186_diretorio_zip/arquivo_1.txt b/aula_186_diretorio_zip/arquivo_1.txt new file mode 100644 index 0000000..9741e29 --- /dev/null +++ b/aula_186_diretorio_zip/arquivo_1.txt @@ -0,0 +1 @@ +arquivo_1 \ No newline at end of file diff --git a/aula_186_diretorio_zip/arquivo_2.txt b/aula_186_diretorio_zip/arquivo_2.txt new file mode 100644 index 0000000..db8d396 --- /dev/null +++ b/aula_186_diretorio_zip/arquivo_2.txt @@ -0,0 +1 @@ +arquivo_2 \ No newline at end of file diff --git a/aula_186_diretorio_zip/arquivo_3.txt b/aula_186_diretorio_zip/arquivo_3.txt new file mode 100644 index 0000000..413cd2e --- /dev/null +++ b/aula_186_diretorio_zip/arquivo_3.txt @@ -0,0 +1 @@ +arquivo_3 \ No newline at end of file diff --git a/aula_186_diretorio_zip/arquivo_4.txt b/aula_186_diretorio_zip/arquivo_4.txt new file mode 100644 index 0000000..ed70dc0 --- /dev/null +++ b/aula_186_diretorio_zip/arquivo_4.txt @@ -0,0 +1 @@ +arquivo_4 \ No newline at end of file diff --git a/aula_186_diretorio_zip/arquivo_5.txt b/aula_186_diretorio_zip/arquivo_5.txt new file mode 100644 index 0000000..380c50d --- /dev/null +++ b/aula_186_diretorio_zip/arquivo_5.txt @@ -0,0 +1 @@ +arquivo_5 \ No newline at end of file diff --git a/aula_186_diretorio_zip/arquivo_6.txt b/aula_186_diretorio_zip/arquivo_6.txt new file mode 100644 index 0000000..d3437a6 --- /dev/null +++ b/aula_186_diretorio_zip/arquivo_6.txt @@ -0,0 +1 @@ +arquivo_6 \ No newline at end of file diff --git a/aula_186_diretorio_zip/arquivo_7.txt b/aula_186_diretorio_zip/arquivo_7.txt new file mode 100644 index 0000000..1101b85 --- /dev/null +++ b/aula_186_diretorio_zip/arquivo_7.txt @@ -0,0 +1 @@ +arquivo_7 \ No newline at end of file diff --git a/aula_186_diretorio_zip/arquivo_8.txt b/aula_186_diretorio_zip/arquivo_8.txt new file mode 100644 index 0000000..449ab27 --- /dev/null +++ b/aula_186_diretorio_zip/arquivo_8.txt @@ -0,0 +1 @@ +arquivo_8 \ No newline at end of file diff --git a/aula_186_diretorio_zip/arquivo_9.txt b/aula_186_diretorio_zip/arquivo_9.txt new file mode 100644 index 0000000..4ef1d0f --- /dev/null +++ b/aula_186_diretorio_zip/arquivo_9.txt @@ -0,0 +1 @@ +arquivo_9 \ No newline at end of file