mmw has asked for the wisdom of the Perl Monks concerning the following question:
How do i retrieve the major and minor number using File::stat?
#!/usr/bin/perl use File::Find; find sub { (-c | -b ) && push(@files,$File::Find::name) } , ("/dev") ; sub retHash () { my ($name, $major, $minor ) = split(",",stat -c '%n,%t,%T' $_`); my $return = {name=> $name, major=> hex($major), minor=> hex($minor +) }; return $return; } @files = map ( &retHash($_) , @files); foreach $item (@files) { print "$item->{name} $item->{major} $item->{minor}\n"; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: How do i find a file major and minor number
by johngg (Canon) on Dec 07, 2011 at 17:55 UTC |
Back to
Seekers of Perl Wisdom