NAME
Dir::Split - Splits the files of a directory to subdirectories
SYNOPSIS
use Dir::Split;
my $dir = Dir::Split->new;
$source_dir = '/var/tmp/src';
$destin_dir = '/var/tmp/destin';
%hash_opt = ( verbose => 0,
sub_dir => { identifier => 'system',
file_limit => '2',
file_sort => '+',
},
suffix => { separator => '.',
length => 4,
continue_numbering => 'y',
},
);
$dir->split (\$source_dir, \$destin_dir, \%hash_opt);
DESCRIPTION
Dir::Split moves files from a source directory to numbered subdirectories within a destination directory.
METHODS
$dir = Dir::Split->new;
Object constructor.
$dir->split (\$source_dir, \$destin_dir, \%hash_opt);
$source_dir specifies the source directory.
$destin_dir specifies the destination directory.
%hash_opt contains the options that will affect the splitting process.
verbose sets the verbosity (see table VERBOSITY MODES below); if enabled, mkpath will output the pathes on creating subdirectories.
sub_dir => identifier will affect the prefix of each subdirectory. sub_dir => file_limit sets the limit of files per each subdirectory. sub_dir => file_sort defines the sorting order of files (see table SORT MODES below).
suffix => separator contains the string that separates the prefix (identifier) from the suffix. suffix => length is an non-floating-point integer that sets the amount of zeros to be added to the subdirectory numbering. suffix => continue_numbering defines whether the numbering shall be continued where it previously stopped or start at 1 (see table CONTINUE NUMBERING MODES below).
VERBOSITY MODES
0 disabled
1 enabled
SORT MODES
+ ascending sort order
- descending sort order
CONTINUE NUMBERING MODES
y yes
'' no
EXAMPLE
Assuming the source directory '/var/tmp/src' contains 9 files, the directory tree in the destination directory '/var/tmp/destin' will look as following:
+ /var/tmp/destin
+- system.0001 / 2 file(s)
+- system.0002 / 2 "
+- system.0003 / 2 "
+- system.0004 / 2 "
+- system.0005 / 1 "
CAVEATS
Recursive source directory processing is not supported.
SEE ALSO
perl(1)
LICENSE
This program is free software; you may redistribute it and/or modify it under the same terms as Perl itself.
AUTHOR
Steven Schubiger