Hello,
I'm using mkzip from tcllib to create ZIP archives. https://core.tcl-lang.org/tcllib/doc/trunk/embedded/md/tcllib/files/modules/zip/mkzip.md
Problem:
A directory that contains multiple files.
I only want to zip a specific file from that directory,
without including the entire absolute path or other files in the
directory in the ZIP archive.
Target:
only testfile01.txt in the zip file
1.)
set zipfile [file join $sourcedir "testfile01.zip"]
set options [list [file join $sourcedir testfile01.txt]] :zipfile::mkzip::mkzip $zipfile {*}$options
works, but with absolute path
2.)
set zipfile [file join $sourcedir "testfile01.zip"]
set options [list -directory [file join $sourcedir] -exclude {d* *02.txt}] ::zipfile::mkzip::mkzip $zipfile {*}$options
works without absolute path, but -exclude has to be adjusted
individually each time
Is there a direct way?
best regards
Gregor
From: greg <gregor.ebbing@gmx.de>
Date: Sun, 2 Jun 2024 10:52:22 +0200
Subject: Re: mkzip and a single file
From: greg <gregor.ebbing@gmx.de>
Date: Sun, 2 Jun 2024 10:52:22 +0200
Subject: Re: mkzip and a single file
This seems to work for me (on Slackware 15ish)
cd $sourcedir
zipfile::mkzip::mkzip testfile01.zip testfile01.txt
Save and restore the current directory using pwd, cd and try if desired.
Dave B
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 498 |
Nodes: | 16 (0 / 16) |
Uptime: | 76:10:16 |
Calls: | 9,820 |
Calls today: | 8 |
Files: | 13,757 |
Messages: | 6,190,029 |