NAME
CTK::File - Files and direcries working
VERSION
Version 1.71
SYNOPSIS
$c->fjoin(
-in => catdir($DATADIR,'in'), # Source directory
-out => catdir($DATADIR,'out'), # Destination directory (for joined file)
-list => qr/txt$/, # Source mask (regular expression, filename or ArrayRef of files)
-fout => 'foo.txt', # Output file name
);
$c->fsplit(
-in => CTK::catfile($CTK::DATADIR,'in'), # Source directory (big files)
-out => CTK::catfile($CTK::DATADIR,'out'), # Destination directory (splitted files)
-n => 100, # Lines count
-format => '[FILENAME]_%03d.[FILEEXT]', # Format
-list => qr//, # Source mask (regular expression, filename or ArrayRef of files)
);
$c->fcopy(
-in => CTK::catfile($CTK::DATADIR,'in'), # Source directory (source files)
-out => CTK::catfile($CTK::DATADIR,'out'), # Destination directory
-format => '[FILE].copy', # Format
-list => qr//, # Source mask (regular expression, filename or ArrayRef of files)
);
$c->fmv(
-in => CTK::catfile($CTK::DATADIR,'in'), # Source directory (source files)
-out => CTK::catfile($CTK::DATADIR,'out'), # Destination directory
-format => '[FILE].copy', # Format
-list => qr//, # Source mask (regular expression, filename or ArrayRef of files)
);
$c->frm(
-in => CTK::catfile($CTK::DATADIR,'in'), # Source directory (source files)
-list => qr//, # Source mask (regular expression, filename or ArrayRef of files)
);
DESCRIPTION
KEYS
- FILE
-
Path and filename
- FILENAME
-
Filename only
- FILEEXT
-
File extension only
- COUNT
-
Current number of file in sequence (for fcopy and fmove methods)
Gor fsplit method please use perl mask %i
- Time
-
Current time value (time())
NOTES
For copying paths: use File::Copy::Recursive qw(dircopy dirmove);
For TEMP dirs/files working: use File::Temp qw/tempfile tempdir/;
METHODS
fjoin
$c->fjoin(
-in => catdir($DATADIR,'in'), # Source directory
-out => catdir($DATADIR,'out'), # Destination directory (for joined file)
-list => qr/txt$/, # Source mask (regular expression, filename or ArrayRef of files)
-fout => 'foo.txt', # Output file name
);
Join group of files (by mask from source directory) to one big file (concatenate). File writes to destination directory by output file name (fout)
perl -MCTK::File -e "CTK::File::fjoin(-cmdmode=>1, -mask=>qr/txt$/, -fout => 'foo.txt')" -- *
This is new features, added since CTK 1.18.
fsplit
$c->fsplit(
-in => CTK::catfile($CTK::DATADIR,'in'), # Source directory (big files)
-out => CTK::catfile($CTK::DATADIR,'out'), # Destination directory (splitted files)
-n => 100, # Lines count
-format => '[FILENAME]_%03d.[FILEEXT]', # Format
-list => qr//, # Source mask (regular expression, filename or ArrayRef of files)
);
Split group of files to parts
fcopy, fcp
$c->fcopy(
-in => CTK::catfile($CTK::DATADIR,'in'), # Source directory (source files)
-out => CTK::catfile($CTK::DATADIR,'out'), # Destination directory
-format => '[FILE].copy', # Format
-list => qr//, # Source mask (regular expression, filename or ArrayRef of files)
);
Copying files from the source directory to the destination directory
fmove, fmv
$c->fmv(
-in => CTK::catfile($CTK::DATADIR,'in'), # Source directory (source files)
-out => CTK::catfile($CTK::DATADIR,'out'), # Destination directory
-format => '[FILE].copy', # Format
-list => qr//, # Source mask (regular expression, filename or ArrayRef of files)
);
Moving files from the source directory to the destination directory
fdelete, fdel, frm
$c->frm(
-in => CTK::catfile($CTK::DATADIR,'in'), # Source directory (source files)
-list => qr//, # Source mask (regular expression, filename or ArrayRef of files)
);
Deleting files from the source directory
AUTHOR
Sergey Lepenkov (Serz Minus) http://www.serzik.com <minus@mail333.com>
COPYRIGHT
Copyright (C) 1998-2017 D&D Corporation. All Rights Reserved
LICENSE
This program is free software; you can redistribute it and/or modify it under the same terms and conditions as Perl itself.
This program is distributed under the GNU LGPL v3 (GNU Lesser General Public License version 3).
See LICENSE
file