How to compress, encrypt, decrypt files with pyquickhelper.
from pyquickhelper.filehelper import download, gzip_files, zip7_files, zip_files
download("https://docs.python.org/3.4/library/urllib.request.html")
'.\\urllib.request.html'
gzip_files("request.html.gz", ["urllib.request.html"])
import os
os.listdir(".")
['.ipynb_checkpoints', 'autosavetime2', 'check_matplotlib_backend.ipynb', 'compare_python_distribution.ipynb', 'example_about_files.ipynb', 'example_completion.ipynb', 'example_documentation.ipynb', 'example_pyquickhelper.ipynb', 'example_with_comments.ipynb', 'exemple_of_fix_menu.ipynb', 'git_dataframes.ipynb', 'having_a_form_in_a_notebook.ipynb', 'javascript_extension.ipynb', 'nbimage.png', 'notebook_with_svg.ipynb', 'README.txt', 'request.html.gz', 'simple_example.ipynb', 'urllib.request.html']
ipy = [ _ for _ in os.listdir(".") if ".ipynb" in _ ]
if os.path.exists("request.html.zip"):
os.remove("notebooks.zip")
zip_files("notebooks.zip", ipy)
14
The following example get all files registered in a repository GIT or SVN.
from pyquickhelper.filehelper import explore_folder_iterfile_repo
files = list ( explore_folder_iterfile_repo(".") )
files
['README.txt', 'check_matplotlib_backend.ipynb', 'compare_python_distribution.ipynb', 'example_about_files.ipynb', 'example_completion.ipynb', 'example_documentation.ipynb', 'example_pyquickhelper.ipynb', 'example_with_comments.ipynb', 'exemple_of_fix_menu.ipynb', 'git_dataframes.ipynb', 'having_a_form_in_a_notebook.ipynb', 'javascript_extension.ipynb', 'nbimage.png', 'notebook_with_svg.ipynb', 'simple_example.ipynb']
%load_ext pyquickhelper
%encrypt_file notebooks.zip notebooks.enc passwordpassword
%decrypt_file notebooks.enc notebooks2.zip passwordpassword