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.gzfile for applicationgv-3.7.4fromhttps://ftp.gnu.org/gnu/gvurl in directory Python.Extract the archive.
Remove file
gv-3.7.4.tar.gzif it exists, so the procedure can be re-runnable.
B)
In directory
gv-3.7.4, recursively find all files with extension.hand copy them into new directoryH_files.Zip directory
H_fileswith its content into fileh.zipRemove directory
H_fileswith 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:
‘https://ftp.gnu.org/pub/gnu/gnats’ ‘gnats-4.2.0’
‘http://ftp.gnu.org/pub/gnu/gperf’ ‘gperf-3.3’