[Gambas-user] UnCompress question
Bruce Steers
bsteers4 at gmail.com
Fri Sep 9 15:16:18 CEST 2022
No that would be multiple archives all with one txt file in each.
I mean for example a gambas source archive that contains all the project
files and folders. or if in your example the single archive contained all
the the text files inside.
How to unpack multiple files/folders out of a single archive.
I can only seem to turn a tar.gz into a single tar file.
I cannot seem to open a directory to write archive contents to only a file.
TIA
BruceS
On Fri, 9 Sept 2022 at 13:57, gian via User <user at lists.gambas-basic.org>
wrote:
> Il 09/09/22 12:18, Bruce Steers ha scritto:
> >
> > So i'm looking at using gb.compress
> >
> > Documentation says all about using UnCompress like a standard file
> > handle so I guess...
> >
> > 1. Open an archive file using Uncompress
> > 2. Open another file handle..
> > 3. Read from uncompress and write data to std file handle.
> >
> > That all makes sense if my file only contains one file
> >
> > But how do you go about writing/unpacking multiple archive file contents
> > out to a directory?
> >
> > Or can gb.compress component not be used that way?
> > I had a look around the IDE code to see if i could find native
> > uncompression methods but only found Shell commands.
> >
> > Many thanks for any advice
> > BruceS
> >
> >
> >
> > ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>
>
> Hi,
>
> I don't know if I understand the question but do you mean something like
> this?
>
> '----------------------------------------
> Private $sPath As String = "/tmp/Foo"
>
> Public Sub Main()
>
> Dim hCompress As New Compress
>
> If Not Exist($sPath) Then Mkdir $sPath
> For i As Integer = 1 To 9
> hCompress.Type = "zlib"
> hCompress.Open($sPath &/ "foo" & i & ".txt.gz")
> Write #hCompress, "Hello World !"
> Close #hCompress
> Next
>
> Decomprimi
>
> End
>
> Private Sub Decomprimi()
>
> Dim hUncompress As New Uncompress
>
> For Each sfile As String In Dir($sPath, "*.gz")
> hUncompress.Type = "zlib"
> hUncompress.File($sPath &/ sfile, $sPath &/ Left(sfile, -3))
> Next
>
> End
> '----------------------------------------
>
> Regards
> Gianluigi
>
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20220909/4dc90a9d/attachment.htm>
More information about the User
mailing list