Mar-16-2018, 08:48 AM
I have implemented the following code to copy a specific file from zip to a certain target directory.
But this copies entire structure into the target directory. The code is:
But this copies entire structure into the target directory. The code is:
import os import zipfile zip_filepath='/home/sundeep/Desktop/SCHEMA AUTOMATION/SOURCE/DSP8010_2017.1.zip' target_dir='/home/sundeep/Desktop/SCHEMA AUTOMATION/SCHEMA' with zipfile.ZipFile(zip_filepath) as zf: dirname = target_dir zf.extract('DSP8010_2017.1/json-schema/AccountService.json',path=dirname)My question is how can I copy only AccountService.json file to target directory but not the entire structure.