NAME

CTK::Plugin::Archive - Archive plugin

VERSION

Version 1.00

SYNOPSIS

    use CTK;
    my $ctk = new CTK(
            plugins => "archive",
        );

    my $n = $ctk->fcompress(
        -dirsrc => "/path/to/source/dir", # Source directory
        -glob   => "*.txt",
        -arcdef => "targz",
        -archive=> "archive.tar.gz",
    );

    my $n = $ctk->fextract(
        -dirsrc => "/path/to/source/dir", # Source directory
        -dirdst => "/path/to/destination/dir", # Destination directory
        -file   => "archive.tar.gz",
        -arcdef => "targz",
    );

DESCRIPTION

Archive (compress and decompress) plugin

Allowed arcdefs: targz, tarxz, tarbz2, tgz, gz, zip, rar

Default arcdef: targz

METHODS

fcompress
    my $n = $ctk->fcompress(
        -dirsrc => "/path/to/source/dir", # Source directory
        -glob   => "*.txt",
        -arcdef => "targz",
        -archive=> "archive.tar.gz",
    );

Сompressing files

-dirin, -in, -input, -dirsrc, , -src

Specifies source directory

Default: current directory

-fileout, -outfile, -archive, -filedst, , -dstfile

Specifies target archive file

-list, -mask, -glob, -file, -files, -regexp
    -list => [qw/ file1.txt file2.txt file3.* /]

List of files or globs

    -glob => "file.*"

Glob pattern

    -file => "file1.txt"

Name of file

    -regexp => qr/\.(cgi|pl)$/i

Regexp

Default: undef (all files)

-options, -opts, -arcdef, -arcopts, -name, -arcname

Defines section of archive options or arcname, for example:

    {
        "ext"        => ".tar.gz",
        "create"     => "tar -cpf \"[NAME].tar\" [LIST]",
        "append"     => "tar -rpf \"[NAME].tar\" [LIST]",
        "postprocess"=> "gzip \"[NAME].tar\"",
        "extract"    => "tar -zxpf \"[FILE]\" -C \"[DIRDST]\"",
    }

or:

    targz

Default: targz

Replacing keys: FILE, NAME, EXT, LIST

fextract
    my $n = $ctk->fextract(
        -dirsrc => "/path/to/source/dir", # Source directory
        -dirdst => "/path/to/destination/dir", # Destination directory
        -file   => "archive.tar.gz",
        -arcdef => "targz",
    );

Extracting files

-dirin, -in, -input, -dirsrc, , -src

Specifies source directory

Default: current directory

-dirout, -out, -output, -dirdst, , -dst

Specifies desination directory

Default: current directory

-list, -mask, -glob, -file, -files, -regexp
    -list => [qw/ file1.zip file2.zip foo*.zip /]

List of files or globs

    -glob => "*.zip"

Glob pattern

    -file => "file1.zip"

Name of file

    -regexp => qr/\.(zip|zip2)$/i

Regexp

Default: undef (all files)

-options, -opts, -arcdef, -arcopts, -name, -arcname

Defines section of archive options or arcname, for example:

    {
        "ext"        => ".tar.gz",
        "create"     => "tar -cpf \"[NAME].tar\" [LIST]",
        "append"     => "tar -rpf \"[NAME].tar\" [LIST]",
        "postprocess"=> "gzip \"[NAME].tar\"",
        "extract"    => "tar -zxpf \"[FILE]\" -C \"[DIRDST]\"",
    }

or:

    targz

Default: targz

Replacing keys: FILE, DIRDST, FILEOUT

REPLACING KEYS

FILE

File with path

In fcompress - destination file; in fextract - souce file

FILEOUT

Output file with path. For fextract only!

NAME

Filename only (with path!). For fcompress only

DIRDST

Destination directory for extracting files. For fextract only!

EXT

File extension only. For fcompress only

LIST

List of source files or one file. For fcompress only

HISTORY

See Changes file

DEPENDENCIES

CTK, CTK::Plugin

TO DO

See TODO file

BUGS

* none noted

SEE ALSO

CTK, CTK::Plugin

AUTHOR

Serż Minus (Sergey Lepenkov) http://www.serzik.com <abalama@cpan.org>

COPYRIGHT

Copyright (C) 1998-2019 D&D Corporation. All Rights Reserved

LICENSE

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

See LICENSE file and https://dev.perl.org/licenses/