perl script help

Hello Experts:

I am looking for multi-threaded script to parse through the NAS folders and subfolders .. and get checksum values of all files

Sample output
Path, File, checksumvalue

Using this script - doesn't work

use File::Find;


find(sub {return unless -f $File::Find::name; system("cksum $File::Find::name");}, '/directory1')

Open in new window


please assist ...

Regards,
LVL 5
CalmSoulAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

wilcoxonCommented:
Personally, I'd do it this way...  This is just using File::Find directly - if it does not perform well enough, we can add in forking to search multiple places at once...

#!/usr/local/bin/perl
use strict;
use warnings;
use File::Find ();
use Cwd ();

# for the convenience of &wanted calls, including -eval statements:
use vars qw/*name *dir *prune/;
*name   = *File::Find::name;
*dir    = *File::Find::dir;

my $cwd = Cwd::cwd();

# Traverse desired filesystems
File::Find::find({wanted => \&wanted}, '/directory1');
exit;

sub wanted {
    return unless (-f $_);
    my $cksum = `cksum $name`;
    $cksum =~ s{^\s+}{};
    $cksum =~ s{\s+.*$}{};
    print "$dir,$_,$cksum\n";
}

Open in new window

0
wilcoxonCommented:
I think your original script would work (at least produce cksum output for each file) if you switch $File::Find::name to $_.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ozoCommented:
In what sense is that multi-threaded?
0
wilcoxonCommented:
It's not.  I figured we'd start with something simple that worked and then move to multi-thread/process.  If the OP is happy with what I provided then that's fine with me.
0
CalmSoulAuthor Commented:
I am just happy somebody replied
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Perl

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.