Python Forum
Find specific file in an archive
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Find specific file in an archive
#1
Hi,
I hope you have better weather than we have tonight in Portland Oregon.
Anyway,
I need to extract a specific file that starts with the word "Debug*.log" from an archive.
An archive may or may not have the file, also the archive is actually a zipped directory with SubDirs and files.
The file I'm looking for could be any of the SubDirs.
I tried to use "zip.namelist" but it only prints files but not recursively,

zip_filepath = 'C:\\02\\TEST-3.zip'
target_dir   = 'C:\\03\\'

zip = zipfile.ZipFile(zip_filepath)
print (zip.namelist())
I understand I need to test the Archive first but not sure how to do that.

Thank you.
Reply


Messages In This Thread
Find specific file in an archive - by tester_V - Feb-12-2021, 03:26 AM
RE: Find specific file in an archive - by perfringo - Feb-12-2021, 08:05 AM
RE: Find specific file in an archive - by tester_V - Feb-12-2021, 09:40 PM
RE: Find specific file in an archive - by tester_V - Feb-13-2021, 02:29 AM
RE: Find specific file in an archive - by tester_V - Feb-13-2021, 04:24 AM
RE: Find specific file in an archive - by tester_V - Feb-13-2021, 06:13 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Extracting specific file from an archive tester_V 4 525 Jan-29-2024, 06:41 PM
Last Post: tester_V
  Find a specific keyword after another keyword and change the output sgtmcc 5 857 Oct-05-2023, 07:41 PM
Last Post: deanhystad
  FileNotFoundError: [WinError 2] The system cannot find the file specified NewBiee 2 1,594 Jul-31-2023, 11:42 AM
Last Post: deanhystad
  Cannot find py credentials file standenman 5 1,667 Feb-25-2023, 08:30 PM
Last Post: Jeff900
  selenium can't find a file in my desk ? SouAmego22 0 751 Feb-14-2023, 03:21 PM
Last Post: SouAmego22
  Reading Specific Rows In a CSV File finndude 3 1,003 Dec-13-2022, 03:19 PM
Last Post: finndude
  Find (each) element from a list in a file tester_V 3 1,239 Nov-15-2022, 08:40 PM
Last Post: tester_V
  Installing Pillow from remote archive in Linux Flatpak ChrisOfBristol 6 1,481 Sep-23-2022, 07:48 PM
Last Post: ChrisOfBristol
  How to extract specific data from .SRC (note pad file) Shinny_Shin 2 1,285 Jul-27-2022, 12:31 PM
Last Post: Larz60+
  what will be the best way to find data in txt file? korenron 2 1,172 Jul-25-2022, 10:03 AM
Last Post: korenron

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020