Python scripts.#

Download an archive and find header files.#

By using jupyter notebook, develop a python script to accomplish the tasks below. Please use only the following python modules: subprocess, glob, os, shutil, and zipfile.

A)

  • Download the tar.gz file for application gv-3.7.4 from https://ftp.gnu.org/gnu/gv url in directory Python.

  • Extract the archive.

  • Remove file gv-3.7.4.tar.gz if it exists, so the procedure can be re-runnable.

B)

  • In directory gv-3.7.4, recursively find all files with extension .h and copy them into new directory H_files.

  • Zip directory H_files with its content into file h.zip

  • Remove directory H_files with its content.

C) Create executable python script download_gv.py that includes the tasks in A and B above.

Unzip file h.zip in the command line to verify the directory contains the .h files.

Provide the URL and the application name in the command line.#

Develop a modified version of the script, download_any.py, that takes the url and the application name as arguments in the command line with --url, and --app by using python module argparse.

Run the script for the following urls and apps: