<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">
use File::Find;
use File::Stat ":FIELDS";             # all exports
use File::Basename;
use Data::Dumper;
use Time::HiRes qw(gettimeofday tv_interval);
use Pod::Usage;
use Getopt::Long;
# Test for Win32 operating system --------------------------------------------------------------------
my $windows=($^O=~/Win/)?1:0;# Are we running on windows?

if ($windows){
  use Win32::File;
  use Win32::FileOp qw(Mapped);
  use Win32::FileSecurity qw(Get EnumerateRights);
  use Win32::OLE qw(in with);
  use Win32::OLE::Variant;
  use Win32::OLE::Const 'Microsoft Excel';
}
#
use strict;
use constant True =&gt; 1;
my(@image_info,$usage,$i,$excel);
my ($name)     = Win32::LoginName;
my ($runtime)  = time;
my ($datetime) = &amp;datetime($runtime);
my ($machine) = Win32::NodeName;    # Determine Machine (Computer) name
my ( $ID, $MAJOR, $MINOR, $YEAR, $MONTH, $DAY, $TIME, $AUTHOR ) =
q$Id: fsinv.pl 1.15 2016/03/11 08:36:32 Dave.Roberts Exp $ =~
/Id: (.+)\s+(\d+)\.(\d+)\s(\d+)\/(\d+)\/(\d+)\s(\d\d:\d\d:\d\d)\s(.+)\s(.+)/;
my (@CallArgs) = @ARGV;
# Process calling arguments -------------------------------------------------------------------
my $images =''; # True to report image files, default false
my $help =''; # True to display help message, default false
my $man =''; # True to display help message, default false
my $version = ""; # True to display version, default false
my $mp3 = ""; # True to report additional information from audio (mp3) files
my $report = "";
GetOptions ("images"  =&gt; \$images, "help" =&gt; \$help, "man" =&gt; \$man, "version" =&gt; \$version, "report=s" =&gt; \$report, "mp3" =&gt; \$mp3)   # flag
or &amp;pod_help("Error in command line arguments\n");
# images switch is true ---------------------------------------------------------------------------
if ($images) {
  use Image::ExifTool qw(:Public);
  @image_info = qw(Model CreateDate CreationDate MediaCreateDate DateTimeOriginal ImageHeight ImageWidth XResolution YResolution ResolutionUnit GPSLatitude GPSLongitude );
}
# ---------------------------------------------------------------------------------------------------
if ($help){
&amp;pod_help();
}
# ---------------------------------------------------------------------------------------------------
if ($version){
  my $message_text = "$ID version $MAJOR.$MINOR";
  print "$message_text\n";
  exit;
}
# ---------------------------------------------------------------------------------------------------
if ($man){
  pod2usage(-exitstatus =&gt; 0, -verbose =&gt; 2);
  exit;
}
# ---------------------------------------------------------------------------------------------------
if ($report){
  unless ($report =~ /(excel|dump)/ ){
    my $message_text = "valid values for report are excel or dump";
    print "$message_text\n";
  exit;
        }
}
#-----------------------------------------------------------------------------------------------------
if ($mp3){
        use MP3::Info;
}
BEGIN { $| = 1; } # autoflush screen output...
my $hmessage = "
";
my $fs = shift or &amp;pod_help("The filesystem name should be specified when calling fsinv\n");

my ($message) = &lt;&lt;"EOT";
*******************************************************************************
Executing script $ID
Script Details:
Version   $MAJOR.$MINOR
Date      $DAY-$MONTH-$YEAR
Time      $TIME
Author    $AUTHOR
Execution:
Computer  $machine
Account   $name
Date/Time $datetime
Calling Arguments: @CallArgs
*******************************************************************************
EOT
print $message;
die if ($usage);
my $start = gettimeofday;
my($inf);
my($loExcel);
# determine a Windows style drive mapping
if (($windows)&amp;($fs =~ /^([a-zA-Z]:)/)){
  $inf-&gt;{drive} = $1;
  $inf-&gt;{$inf-&gt;{drive}} = Mapped $inf-&gt;{drive};
}

print " * Reading file system... ";
&amp;File::Find::find(\&amp;wanted,$fs);
my $end = gettimeofday;
my $time = $end - $start;

printf STDERR "\b   complete (took %s)\n",&amp;best_int($time);

# Test if Excel is available for output --------------------------------------------

if ($windows){
# Use existing instance if Excel is already running or start Excel
        eval {$loExcel = Win32::OLE-&gt;GetActiveObject('Excel.Application')};
        print "Excel not installed\n" if $@;
        unless (defined $loExcel) {
                $loExcel = Win32::OLE-&gt;new('Excel.Application','Quit')
                or print "Unable to start Excel\n";
         }
         print "Excel is installed\n" if ($loExcel);
}
# Logic for determining report to produce -------------------------------------
if ($report eq ""){
        if ($loExcel){
                $report = "excel" ;
        }else{
                $report = "dump" ;
        }
}
if ($report eq "excel"){
      print "Generating Excel report\n";
      &amp;excelreport($loExcel,$inf);
}elsif($report eq "dump"){
      print "Generating dump report\n";
      print Dumper($inf);
}else{
      print "No report defined\n";
}
exit;
#-------------------------------------------------------------------------------
sub wanted {
use Integer;
if (-d $_){
  my($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
  $atime,$mtime,$ctime,$blksize,$blocks) = stat($_);
  $inf-&gt;{d}-&gt;{$File::Find::name . "/"}-&gt;{atime} = &amp;datetime($atime);
  $inf-&gt;{d}-&gt;{$File::Find::name . "/"}-&gt;{mtime} = &amp;datetime($mtime);
  $inf-&gt;{d}-&gt;{$File::Find::name . "/"}-&gt;{ctime} = &amp;datetime($ctime);
  $inf-&gt;{stats}-&gt;{totalfolders} +=1;
  }elsif(-f $_){
# we're checking files
  my($name,$path,$suffix) = fileparse($File::Find::name, qr/\.[^.]*/);
  my($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
  $atime,$mtime,$ctime,$blksize,$blocks) = stat($_);
  $inf-&gt;{f}-&gt;{$path . $name . $suffix}-&gt;{path}=$path;
  $inf-&gt;{f}-&gt;{$path . $name . $suffix}-&gt;{suffix}=$suffix;
  $inf-&gt;{f}-&gt;{$path . $name . $suffix}-&gt;{filename}=$name . $suffix;
  $inf-&gt;{f}-&gt;{$path . $name . $suffix}-&gt;{size} = $size;
  $inf-&gt;{f}-&gt;{$path . $name . $suffix}-&gt;{atime} = &amp;datetime($atime);
  $inf-&gt;{f}-&gt;{$path . $name . $suffix}-&gt;{mtime} = &amp;datetime($mtime);
  $inf-&gt;{f}-&gt;{$path . $name . $suffix}-&gt;{ctime} = &amp;datetime($ctime);
  $inf-&gt;{d}-&gt;{$path}-&gt;{size} +=$size;
  $inf-&gt;{d}-&gt;{$path}-&gt;{sizeinc} +=$size;
  $inf-&gt;{d}-&gt;{$path}-&gt;{totalfiles} +=1;
  $inf-&gt;{stats}-&gt;{totalfiles} +=1;
  if (($images) &amp; ($suffix =~ /jpg$/i)){  # get image info - for image files
    my $tool = Image::ExifTool-&gt;new();
    $tool-&gt;Options(Unknown =&gt; 1, DateFormat =&gt; '%d/%M/%Y %H:%M:%S');
    if ($tool-&gt;ExtractInfo($_)){
      my($z);
      foreach $z (@image_info){
        if ($tool-&gt;GetValue($z)){
          $inf-&gt;{f}-&gt;{$path . $name . $suffix}-&gt;{image}-&gt;{$z} = $tool-&gt;GetValue($z);
        }
      }
      }else{
      print "Image::ExifTool Error: $!\n";
    }
  }elsif(($mp3) &amp; ($suffix =~ /mp3$/i)){  # get image info - for image files
  print "getting mp3 info for $path $name $suffix\n";
      my $info = get_mp3info($_);
      my $tags = get_mp3tag($_) or print "No TAG info\n";
      $inf-&gt;{f}-&gt;{$path . $name . $suffix}-&gt;{MP3INFO}=$info;
      $inf-&gt;{f}-&gt;{$path . $name . $suffix}-&gt;{MP3TAGS}=$tags;
      }
  my($parent) = $path;
  while ($parent =~ s/[^\/]+\/$//){
    last unless ($inf-&gt;{d}-&gt;{$parent});
    $inf-&gt;{d}-&gt;{$parent}-&gt;{sizeinc} +=$size;
  }
}
&amp;spin();      # prints next character
}
#-------------------------------------------------------------------------------
sub datetime {
my($t) = @_;
my($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($t);
my($month) = ('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec')[$mon];
#my($datetime) = sprintf "%2d %s %02d",
my($datetime) = sprintf "%2d %s %4d %2d:%02d:%02d",
$mday,$month,($year+1900), $hour, $min, $sec;
return $datetime;
}
#-------------------------------------------------------------------------------
sub excelreport {
my($excel) = shift;
my($inf) = shift;
my($vnt);

$excel-&gt;{Visible} = 1;
$excel-&gt;{SheetsInNewWorkbook} = 3;
my ($book) = $excel-&gt;Workbooks-&gt;Add;
# Create Files Worksheet .................................................................................................
my ($w) = $book-&gt;Worksheets(2);
my($r) = 1;
my ($col) = 7;
$w-&gt;Cells($r,1)-&gt;Font() -&gt; {'Bold'}= True;
$w-&gt;Cells($r,1)-&gt;{Value} = "Name";
$w-&gt;Cells($r,2)-&gt;Font() -&gt; {'Bold'}= True;
$w-&gt;Cells($r,2)-&gt;{Value} = "File";
$w-&gt;Cells($r,3)-&gt;Font() -&gt; {'Bold'}= True;
$w-&gt;Cells($r,3)-&gt;{Value} = "Suffix";
$w-&gt;Cells($r,4)-&gt;Font() -&gt; {'Bold'}= True;
$w-&gt;Cells($r,4)-&gt;{Value} = "Size";
$w-&gt;Cells($r,5)-&gt;Font() -&gt; {'Bold'}= True;
$w-&gt;Cells($r,5)-&gt;{Value} = "atime (accessed)";
$w-&gt;Cells($r,6)-&gt;Font() -&gt; {'Bold'}= True;
$w-&gt;Cells($r,6)-&gt;{Value} = "mtime (modified)";
$w-&gt;Cells($r,7)-&gt;Font() -&gt; {'Bold'}= True;
$w-&gt;Cells($r,7)-&gt;{Value} = "ctime (created)";
with($w-&gt;Columns(1),  ColumnWidth =&gt; 40, HorizontalAlignment =&gt; xlLeft);
with($w-&gt;Columns(2),  ColumnWidth =&gt; 25, HorizontalAlignment =&gt; xlLeft);
with($w-&gt;Columns(4),  NumberFormat        =&gt; '#,##0', ColumnWidth =&gt; 18, HorizontalAlignment =&gt; xlRight);
  with($w-&gt;Columns(5),  NumberFormat        =&gt; 'dd/mm/yyyy hh:mm:ss', ColumnWidth =&gt; 18, HorizontalAlignment =&gt; xlRight);
  with($w-&gt;Columns(6),  NumberFormat        =&gt; 'dd/mm/yyyy hh:mm:ss', ColumnWidth =&gt; 18, HorizontalAlignment =&gt; xlRight);
  with($w-&gt;Columns(7),  NumberFormat        =&gt; 'dd/mm/yyyy hh:mm:ss', ColumnWidth =&gt; 18, HorizontalAlignment =&gt; xlRight);
  my %cols;
  if ($images) {      # Create titles/formats for columns showing image info
    $col = 8;
    foreach (@image_info) {
      $cols{$_} = $col;
      $w-&gt;Cells($r,$col)-&gt;Font() -&gt; {'Bold'}= True;
      $w-&gt;Cells($r,$col)-&gt;{Value} = $_;
      with($w-&gt;Columns($col),  NumberFormat        =&gt; 'dd/mm/yyyy hh:mm:ss', ColumnWidth =&gt; 18, HorizontalAlignment =&gt; xlRight) if ($_ =~ /Date/);
      $col++;
    }
  }
  $w-&gt;{Name} = "Files";
  foreach (sort keys %{$inf-&gt;{f}}){
    $r++;
    $w-&gt;Cells($r,1)-&gt;{Value} = &amp;backslash($_);
    $w-&gt;Cells($r,2)-&gt;{Value} = $inf-&gt;{f}-&gt;{$_}-&gt;{filename};
    $w-&gt;Cells($r,3)-&gt;{Value} = $inf-&gt;{f}-&gt;{$_}-&gt;{suffix};
    $w-&gt;Cells($r,4)-&gt;{Value} = Win32::OLE::Variant-&gt;new(VT_R8,  $inf-&gt;{f}-&gt;{$_}-&gt;{size});
    $w-&gt;Cells($r,5)-&gt;{Value} = Win32::OLE::Variant-&gt;new(VT_DATE, $inf-&gt;{f}-&gt;{$_}-&gt;{atime});
    $w-&gt;Cells($r,6)-&gt;{Value} = Win32::OLE::Variant-&gt;new(VT_DATE, $inf-&gt;{f}-&gt;{$_}-&gt;{mtime});
    $w-&gt;Cells($r,7)-&gt;{Value} = Win32::OLE::Variant-&gt;new(VT_DATE, $inf-&gt;{f}-&gt;{$_}-&gt;{ctime});
    if ($images) {
      $col = 8;
      foreach my $z (@image_info) {
        if ($inf-&gt;{f}-&gt;{$_}-&gt;{image}) {
          if ($z =~ /Date/){
            $w-&gt;Cells($r,$col)-&gt;{Value} = Win32::OLE::Variant-&gt;new(VT_DATE, $inf-&gt;{f}-&gt;{$_}-&gt;{image}-&gt;{$z});
            }else{
            $w-&gt;Cells($r,$col)-&gt;{Value} = $inf-&gt;{f}-&gt;{$_}-&gt;{image}-&gt;{$z};
          }
        }
        $col++;
      }
    }
  }
  $w-&gt;Range("A:" . &amp;col($col))-&gt;Columns-&gt;AutoFilter("1","&lt;&gt;"); # set AutoFilter on
  $w-&gt;Range("A:" . &amp;col($col))-&gt;Columns-&gt;AutoFit;              # Set AutoFit Column Widths
  for (1..$col) {
#foreach( qw (A B C D E F G)){                    # Set max column width to 50 characters
    if (($w-&gt;Columns(&amp;col($_))-&gt;{'ColumnWidth'}) &gt; 50 ) {
      $w-&gt;Columns(&amp;col($_))-&gt;{'ColumnWidth'} = 50;
    }
  }
# Create Folders Worksheet ...............................................................................................
  $w = $book-&gt;Worksheets(3);
  $r = 1;
  $w-&gt;Cells($r,1)-&gt;Font() -&gt; {'Bold'}= True;
  $w-&gt;Cells($r,1)-&gt;{Value} = "Directory";
  $w-&gt;Cells($r,2)-&gt;Font() -&gt; {'Bold'}= True;
  $w-&gt;Cells($r,2)-&gt;{Value} = "Size (excl subfolders)";
  $w-&gt;Cells($r,3)-&gt;Font() -&gt; {'Bold'}= True;
  $w-&gt;Cells($r,3)-&gt;{Value} = "Size (incl subfolders)";
  $w-&gt;Cells($r,4)-&gt;Font() -&gt; {'Bold'}= True;
  $w-&gt;Cells($r,4)-&gt;{Value} = "Total Files";
  $w-&gt;Cells($r,5)-&gt;Font() -&gt; {'Bold'}= True;
  $w-&gt;Cells($r,5)-&gt;{Value} = "atime (accessed)";
  $w-&gt;Cells($r,6)-&gt;Font() -&gt; {'Bold'}= True;
  $w-&gt;Cells($r,6)-&gt;{Value} = "mtime (modified)";
  $w-&gt;Cells($r,7)-&gt;Font() -&gt; {'Bold'}= True;
  $w-&gt;Cells($r,7)-&gt;{Value} = "ctime (created)";
  with($w-&gt;Columns(1),  ColumnWidth =&gt; 40, HorizontalAlignment =&gt; xlLeft);
  with($w-&gt;Columns(2),  ColumnWidth =&gt; 18, HorizontalAlignment =&gt; xlRight);
  with($w-&gt;Columns(3),  ColumnWidth =&gt; 18, HorizontalAlignment =&gt; xlRight);
  with($w-&gt;Columns(4),  ColumnWidth =&gt; 18, HorizontalAlignment =&gt; xlRight);
  with($w-&gt;Columns(2),  NumberFormat        =&gt; '#,##0', ColumnWidth =&gt; 18, HorizontalAlignment =&gt; xlRight);
    with($w-&gt;Columns(3),  NumberFormat        =&gt; '#,##0', ColumnWidth =&gt; 18, HorizontalAlignment =&gt; xlRight);
      with($w-&gt;Columns(5),  NumberFormat        =&gt; 'dd/mm/yyyy hh:mm:ss', ColumnWidth =&gt; 18, HorizontalAlignment =&gt; xlRight);
      with($w-&gt;Columns(6),  NumberFormat        =&gt; 'dd/mm/yyyy hh:mm:ss', ColumnWidth =&gt; 18, HorizontalAlignment =&gt; xlRight);
      with($w-&gt;Columns(7),  NumberFormat        =&gt; 'dd/mm/yyyy hh:mm:ss', ColumnWidth =&gt; 18, HorizontalAlignment =&gt; xlRight);
      $w-&gt;{Name} = "Folders";
      foreach (sort keys %{$inf-&gt;{d}}){
        $r++;
        $w-&gt;Cells($r,1)-&gt;{Value} = &amp;backslash($_);
        $w-&gt;Cells($r,2)-&gt;{Value} = Win32::OLE::Variant-&gt;new(VT_R8,  $inf-&gt;{d}-&gt;{$_}-&gt;{size});
        $w-&gt;Cells($r,3)-&gt;{Value} = Win32::OLE::Variant-&gt;new(VT_R8,  $inf-&gt;{d}-&gt;{$_}-&gt;{sizeinc});
        $w-&gt;Cells($r,4)-&gt;{Value} = $inf-&gt;{d}-&gt;{$_}-&gt;{totalfiles};
        $w-&gt;Cells($r,5)-&gt;{Value} = Win32::OLE::Variant-&gt;new(VT_DATE, $inf-&gt;{d}-&gt;{$_}-&gt;{atime});
        $w-&gt;Cells($r,6)-&gt;{Value} = Win32::OLE::Variant-&gt;new(VT_DATE, $inf-&gt;{d}-&gt;{$_}-&gt;{mtime});
        $w-&gt;Cells($r,7)-&gt;{Value} = Win32::OLE::Variant-&gt;new(VT_DATE, $inf-&gt;{d}-&gt;{$_}-&gt;{ctime});
      }
      $w-&gt;Range("A:F")-&gt;Columns-&gt;AutoFilter("1","&lt;&gt;"); # set AutoFilter on
      $w-&gt;Range("A:F")-&gt;Columns-&gt;AutoFit;              # Set AutoFit Column Widths
      foreach( qw (A B C D E F)){                    # Set max column width to 50 characters
        if (($w-&gt;Columns($_)-&gt;{'ColumnWidth'}) &gt; 50 ) {
          $w-&gt;Columns($_)-&gt;{'ColumnWidth'} = 50;
        }
      }
# Create Report Summary Worksheet .................................................................................................
      $w = $book-&gt;Worksheets(1);
      my($c) = 2;
      $w-&gt;{Name} = "Report Summary";
      $w-&gt;Cells(2,$c)-&gt;Font() -&gt; {'Bold'}= True;
      $w-&gt;Cells(2,$c)-&gt;{Value} = "Account Name";
      $w-&gt;Cells(3,$c)-&gt;Font() -&gt; {'Bold'}= True;
      $w-&gt;Cells(3,$c)-&gt;{Value} = "Computer Name";
      $w-&gt;Cells(4,$c)-&gt;Font() -&gt; {'Bold'}= True;
      $w-&gt;Cells(4,$c)-&gt;{Value} = "Date/Time - Report Start";
      $w-&gt;Cells(4,$c)-&gt;Font() -&gt; {'Bold'}= True;
      $w-&gt;Cells(5,$c)-&gt;{Value} = "Runtime";
      $w-&gt;Cells(5,$c)-&gt;Font() -&gt; {'Bold'}= True;
      $w-&gt;Cells(6,$c)-&gt;{Value} = "Name";
      $w-&gt;Cells(6,$c)-&gt;Font() -&gt; {'Bold'}= True;
      $w-&gt;Cells(7,$c)-&gt;{Value} = "Version";
      $w-&gt;Cells(7,$c)-&gt;Font() -&gt; {'Bold'}= True;
      $w-&gt;Cells(8,$c)-&gt;{Value} = "Date";
      $w-&gt;Cells(8,$c)-&gt;Font() -&gt; {'Bold'}= True;
      $w-&gt;Cells(9,$c)-&gt;{Value} = "Argument";
      $w-&gt;Cells(9,$c)-&gt;Font() -&gt; {'Bold'}= True;
      $w-&gt;Cells(10,$c)-&gt;{Value} = "Total Files";
      $w-&gt;Cells(10,$c)-&gt;Font() -&gt; {'Bold'}= True;
      $w-&gt;Cells(11,$c)-&gt;{Value} = "Total File Size";
      $w-&gt;Cells(11,$c)-&gt;Font() -&gt; {'Bold'}= True;
      $w-&gt;Cells(12,$c)-&gt;{Value} = "Total Folders";
      $w-&gt;Cells(12,$c)-&gt;Font() -&gt; {'Bold'}= True;
      if ($inf-&gt;{drive} &amp; $inf-&gt;{$inf-&gt;{drive}}){
        $w-&gt;Cells(13,$c)-&gt;{Value} = "Drive Mapping";
        $w-&gt;Cells(13,$c)-&gt;Font() -&gt; {'Bold'}= True;
      }
      with($w-&gt;Columns(1),  ColumnWidth =&gt; 2, HorizontalAlignment =&gt; xlLeft);
      with($w-&gt;Columns(2),  ColumnWidth =&gt; 25, HorizontalAlignment =&gt; xlLeft);
      with($w-&gt;Columns(3),  ColumnWidth =&gt; 20, HorizontalAlignment =&gt; xlLeft);
      $c = 3;
      with($w-&gt;Cells(4,$c),  NumberFormat        =&gt; 'dd/mm/yyyy hh:mm:ss');
      with($w-&gt;Cells(5,$c),  NumberFormat        =&gt; 'dd/mm/yyyy');
      with($w-&gt;Cells(10,$c),  NumberFormat        =&gt; '#,##0', HorizontalAlignment =&gt; xlRight);
        with($w-&gt;Cells(11,$c),  NumberFormat        =&gt; '[&gt;999999999999]0.000,,,," TB";[&gt;999999999]0.000,,," GB";0.000,," MB"', HorizontalAlignment =&gt; xlRight);
        with($w-&gt;Cells(12,$c),  NumberFormat        =&gt; '#,##0', HorizontalAlignment =&gt; xlRight);
          $w-&gt;Cells(2,$c)-&gt;{Value} = $name;
          $w-&gt;Cells(3,$c)-&gt;{Value} = $machine;
          $w-&gt;Cells(4,$c)-&gt;{Value} = Win32::OLE::Variant-&gt;new(VT_DATE, $datetime);
          $w-&gt;Cells(5,$c)-&gt;{Value} = &amp;best_int($time);
          $w-&gt;Cells(6,$c)-&gt;{Value} = $ID;
          $w-&gt;Cells(7,$c)-&gt;{Value} = sprintf "%d.%d",$MAJOR,$MINOR;
          $w-&gt;Cells(8,$c)-&gt;{Value} = sprintf "%d-%s-%d",$DAY,$MONTH,$YEAR;
          my $arg;
          foreach (@CallArgs){
            $arg .= $_ . " ";
          }
          $w-&gt;Cells(9,$c)-&gt;{Value} = $arg;
          $w-&gt;Cells(10,$c)-&gt;{Value} = $inf-&gt;{stats}-&gt;{totalfiles};
          $w-&gt;Cells(11,$c)-&gt;{Value} = "=SUM(FILES!D:D)";
          $w-&gt;Cells(12,$c)-&gt;{Value} = $inf-&gt;{stats}-&gt;{totalfolders};
          if ($inf-&gt;{drive} &amp; $inf-&gt;{$inf-&gt;{drive}}){
            $w-&gt;Cells(13,$c)-&gt;{Value} = sprintf "%s  =&gt;  %s",$inf-&gt;{drive},$inf-&gt;{$inf-&gt;{drive}};
          }
        }
#-------------------------------------------------------------------------------
sub backslash {
          my ($a) = @_;
          $a =~ s/\//\\/g;
          return $a;
        }
#-------------------------------------------------------------------------------
sub best_int
        {
          use integer;
          my $s = shift;
          return sprintf ":%02d sec", $s if $s &lt; 60;
          my $m = $s / 60; $s = $s % 60;
          return sprintf "%02d:%02d min:sec", $m, $s if $m &lt; 60;
          my $h = $m /  60; $m %= 60;
          return sprintf "%02d:%02d:%02d hr:min:sec", $h, $m, $s if $h &lt; 24;
          my $d = $h / 24; $h %= 24;
          return sprintf "%d:%02d:%02d:%02d day:hr:min:sec", $d, $h, $m, $s;
        }
#-------------------------------------------------------------------------------        
sub spin {
          my %spinner = (
            '|' =&gt; '/',
            '/' =&gt; '-',
            '-' =&gt; '\\',
            '\\' =&gt; '|'
          );
          $i = (! defined $i) ? '|' : $spinner{$i};
          print STDERR "\b$i";
        }
        sub col{
          my ($num) = @_;
          my($base)=26;
          my($mem) = "";
          my($h,$c);
          while ($num &gt;= $base){
            $h = int($num/$base);
            $c = $num -($h*$base);
            if ($c eq 0){
              $c = $base;
              $h--;
            }
            $mem = chr($c+64) . $mem;
            $num = $h;
          }
          $mem = chr($num+64) . $mem unless ($num eq 0);
          return  $mem;
        }
#-------------------------------------------------------------------------------
sub pod_help{
          my $message_text  = shift;
          my $exit_status   = 2;          ## The exit status to use
          my $verbose_level = 1;          ## The verbose level to use
          my $filehandle    = \*STDERR;   ## The filehandle to write to
 pod2usage( { -message =&gt; $message_text ,
              -exitval =&gt; $exit_status  ,
             -verbose =&gt; $verbose_level,
            -output  =&gt; $filehandle } );
   exit;
   }
#-------------------------------------------------------------------------------
   
__END__
=pod
        
=head1 NAME
        
   fsinv.pl - A simple program that documents a file system
        
=head1 SYNOPSIS
        
  fsinv.pl filesystem [options]
        
=head1 OPTIONS
        
=over 8
        
=item B&lt;--help&gt;

Show brief usage help information.
        
=item B&lt;--manual&gt;

Read the manual, with examples.
        
=item B&lt;--images&gt;

Include information from image files in the report
        
=item B&lt;--version&gt;

Show the version number and exit.

=item B&lt;--images&gt;

Read and report the following attributes of .jpg suffix files (see MP3::Info for more information). These are only reported if they are identified.
         
=over 16         

=item Model 


=item CreateDate


=item CreationDate


=item MediaCreateDate


=item DateTimeOriginal


=item ImageHeight


=item ImageWidth 


=item XResolution 


=item YResolution


=item ResolutionUnit


=item GPSLatitude


=item GPSLongitude

=back

=item B&lt;--mp3&gt;

Read MP3TAGS and MP3INFO for MP3 files and include these in the report where files have the .mp3 suffix (see MP3::Info for more information)
        
=item B&lt;--report=name&gt;

Where report is set to either

        "excel" - the default for a windows system with Microsoft Excel installed

        "dump" - the default where Excel is not available


=back
        
=head1 EXAMPLES
        
        fsinv.pl //server/share/folder
        
        fsinv.pl \\server\share\folder -images
        
        fsinv.pl D:\temp
        
        fsinv.pl /myfolder


=head1 DESCRIPTION
        
This is a simple program to generate an inventory report for a file system.
The report is generated as an Excel file (on Win32 systems with Excel installed)
, or otherwise is dumped as STDOUT.
 
 
=head1 COPYRIGHT AND LICENSE

Copyright 2015 Dave Roberts



This is released under the Artistic 
License. See L&lt;perlartistic&gt;.

       
=head1 AUTHOR
        
Dave Roberts
--
david.roberts@cpan.org
        
=head1  VERSION
        
$Id: fsinv.pl 1.15 2016/03/11 08:36:32 Dave.Roberts Exp $
        
=cut
</pre></body></html>