NAME
CTK::Plugin::Archive - Archive plugin
VERSION
Version 1.03
SYNOPSIS
use CTK;
my $ctk = CTK->new(
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, -dirsrc, -src, -source
-
Specifies source directory
Default: current directory
- -file, -fileout, -archive, -target
-
Specifies target archive file
Required parameter
- -list, -mask, -glob, -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, -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, -dirsrc, -src, -source
-
Specifies source directory
Default: current directory
- -dirout, -out, -dirdst, -dst, -target
-
Specifies destination directory
Default: current directory
- -list, -mask, -glob, -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, -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
TO DO
See TODO
file
BUGS
* none noted
SEE ALSO
AUTHOR
Serż Minus (Sergey Lepenkov) https://www.serzik.com <abalama@cpan.org>
COPYRIGHT
Copyright (C) 1998-2022 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/