<<

How to use Data-Collection/Data-Collection-Search

Adding storage Media

Open your favorite console and Enter add_media_cl.pl [-l disk location] [-n disk name] [-v verbose] [-d decompress]

OR

add_media_cl.pl [--disk_location disk location] [--disk_name disk name] [--verbose verbose] [--decompress decompress]

Examples

1) Add a media named "Backup" and decompresses archives

add_media_cl.pl -l /media/cdrom -n Backup --decompress 1

2) Add a media named "Wedding Pictures", do not decompresses archives, and view each file

add_media_cl.pl --disk_location /media/cdrom --disk_name Backup -d 0 -v 1

3) Perl script that adds a media named "08_08_Backup_1" and decompresses archives

#!/usr/bin/perl -w

use strict;

use Data::Collection qw/read_directory/;

my $dc = Data::Collection->new('/media/cdrom', '08_08_Backup_1', {verbose => 0, decompress => 1});

my $info = $dc->read_directory();

print $$info;

exit(0);

Help

add_media_cl.pl [-h]

OR

add_media_cl.pl [--help]

Search storage Media

Enter in your favorite console

search_media_cl.pl [-t search_term] [-c case_sens]

OR

search_media_cl.pl [--search_term search term] [--case_sens case sens]

Examples

1) Search for the term "f" in a case-sensitive manner

search_media_cl.pl -t f -c 1

2) Search for the term "wood" in a non case-sensitive manner

search_media_cl.pl --search_term wood -c 0

3) Perl script that searches for the term "Perl" in a case-sensitive manner

#!/usr/bin/perl -w

use strict;

use Time::HiRes qw(gettimeofday);

use Data::Collection qw/read_directory/;

use Data::Collection::Search qw/search elapsed_time/;

my ($search_term, $case_sens) = ('Perl', 1);

my ($sec_start, $usec_start) = gettimeofday(); #get seconds and microseconds since the epoch

my ($report_loc, $number, $disks) = Data::Collection::Search->search(\$search_term, \$case_sens);

my ($sec_finish, $usec_finish) = gettimeofday(); #get seconds and microseconds since the epoch

my $time_ref = Data::Collection::Search->elapsed_time($sec_start,$usec_start,$sec_finish,$usec_finish);

print ($$number > 0 ? sprintf(qq{\tThe search returned }. $$number .qq{ result%s for '}. $search_term .qq{' in %0.3f seconds on @$disks. You can view the XML report in $$report_loc.\n\n},( $$number == 1 ? '' : 's' ), $$time_ref) : sprintf(qq{\tThe term '$search_term' could not be found in %0.3f seconds.\n\n}, $$time_ref));

exit(0);

<<