Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Failing to Zip files
#3
Thanks bowlofred!

I tried your suggestions.
Still the script only copies files not zipps then up.
I actually tried to open one of the copied files, they all have extensions '.TXT' but it is not a'.TXT' file. I cannot really open it up. SO the script does something to the files.
here is a new version of the script:
from zipfile import ZipFile
import os
import glob
import os.path

zout= 'C:\\0001\\'
for fname in glob.glob('C:\\02\\*[0-9].*'):
    print (fname)
    basename = os.path.basename(fname)
    fz = zout+basename
    print (fz)
    with ZipFile(fz,'w') as zip: 
        zip.write(fname)
Reply


Messages In This Thread
Failing to Zip files - by tester_V - Dec-01-2020, 02:46 AM
RE: Failing to Zip files - by bowlofred - Dec-01-2020, 03:47 AM
RE: Failing to Zip files - by tester_V - Dec-01-2020, 05:05 AM
RE: Failing to Zip files - by bowlofred - Dec-01-2020, 07:14 AM
RE: Failing to Zip files - by tester_V - Dec-01-2020, 07:28 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Failing to connect by 'net use' tester_V 1 214 Apr-20-2024, 06:31 AM
Last Post: tester_V
  Failing to print sorted files tester_V 4 1,319 Nov-12-2022, 06:49 PM
Last Post: tester_V
  Failing regex tester_V 3 1,214 Aug-16-2022, 03:53 PM
Last Post: deanhystad
  Failing to connect to a host with WMI tester_V 6 4,454 Aug-10-2021, 06:25 PM
Last Post: tester_V
  Failing to get Stat for a Directory tester_V 11 3,609 Jul-20-2021, 10:59 PM
Last Post: Larz60+
  Python 3.8 on mac failing to start sgandon 0 2,933 Jan-14-2020, 10:58 AM
Last Post: sgandon
  trying to install oandapy and failing ErnestTBass 0 1,936 Feb-24-2019, 06:13 PM
Last Post: ErnestTBass
  Pyinstaller failing JP_ROMANO 2 4,102 Jan-16-2019, 06:07 PM
Last Post: JP_ROMANO
  Why is my for loop failing? microphone_head 4 3,008 Sep-11-2018, 01:21 PM
Last Post: microphone_head

Forum Jump:

User Panel Messages

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