Building off comments from others, here's something that I came up that I think does what you're wanting.

use strict; use warnings; use feature 'say'; use File::Find::Rule; my $dir = 'C:\testdir'; if ($#ARGV >= 0) {$dir = $ARGV[0];} my $rule = File::Find::Rule->new; my @items = $rule->in($dir); my @fields = ("dev","ino","mode","nlink","uid","gid","rdev","size","at +ime", "mtime","ctime","blksize","blocks"); my %num; my $index = 0; foreach my $field (@fields) { $num{$field} = $index; $index++; } foreach my $item (@items) { my $type = (-f $item) ? 'file' : (-l $item) ? 'symbolic link' : (-d $item) ? 'directory' : (-b $item) ? 'block special file' : (-c $item) ? 'character special file' : (-p $item) ? 'named pipe' : (-S $item) ? 'socket' : 'unkown'; my (@lstat) = lstat $item; my %times; foreach my $time ("atime","ctime","mtime") { $times{$time} = localtime($lstat[$num{$time}]); } my $size = commify($lstat[$num{'size'}]); my $perms = sprintf "%04o", $lstat[$num{'mode'}] & 07777; $item =~ s|\/|\\|g; say "Found item '$item'"; say " Type: $type"; say " Permissions: $perms"; say " Size: $size bytes"; say " Access Time: $times{'atime'}"; say " Inode change time: $times{'ctime'}"; say " Last modify time: $times{'mtime'}"; say "\n"; } sub commify { my $input = shift; $input = reverse $input; $input =~ s/(\d\d\d)(?=\d)(?!\d*\.)/$1,/g; return reverse $input; }

Below is a sample output from the code above. There are two Windows shortcuts to cmd.exe included in the output, which did not cause any problems. It kind of looks like you were trying to parse through the folder that holds the "Favorites" from Internet Explorer. I tested the script above against the Favorites folder on my system and I didn't encounter any issues.

Found item 'C:\testdir' Type: directory Permissions: 0777 Size: 0 bytes Access Time: Wed Aug 20 10:49:37 2014 Inode change time: Wed Aug 20 10:47:33 2014 Last modify time: Wed Aug 20 10:49:37 2014 Found item 'C:\testdir\cmd.lnk' Type: file Permissions: 0666 Size: 1,197 bytes Access Time: Wed Aug 20 10:48:44 2014 Inode change time: Wed Aug 20 10:48:44 2014 Last modify time: Wed Aug 20 10:49:37 2014 Found item 'C:\testdir\test1.txt' Type: file Permissions: 0666 Size: 14 bytes Access Time: Wed Aug 20 10:48:08 2014 Inode change time: Wed Aug 20 10:48:08 2014 Last modify time: Wed Aug 20 10:50:15 2014 Found item 'C:\testdir\test2.txt' Type: file Permissions: 0666 Size: 17 bytes Access Time: Wed Aug 20 10:48:20 2014 Inode change time: Wed Aug 20 10:48:08 2014 Last modify time: Wed Aug 20 10:50:24 2014 Found item 'C:\testdir\dir1' Type: directory Permissions: 0777 Size: 0 bytes Access Time: Wed Aug 20 10:50:30 2014 Inode change time: Wed Aug 20 10:48:33 2014 Last modify time: Wed Aug 20 10:50:30 2014 Found item 'C:\testdir\dir1\cmd.lnk' Type: file Permissions: 0666 Size: 1,197 bytes Access Time: Wed Aug 20 10:50:30 2014 Inode change time: Wed Aug 20 10:50:30 2014 Last modify time: Wed Aug 20 10:49:37 2014 Found item 'C:\testdir\dir1\test1.txt' Type: file Permissions: 0666 Size: 14 bytes Access Time: Wed Aug 20 10:50:30 2014 Inode change time: Wed Aug 20 10:50:30 2014 Last modify time: Wed Aug 20 10:50:15 2014 Found item 'C:\testdir\dir1\test2.txt' Type: file Permissions: 0666 Size: 17 bytes Access Time: Wed Aug 20 10:50:30 2014 Inode change time: Wed Aug 20 10:50:30 2014 Last modify time: Wed Aug 20 10:50:24 2014

In reply to Re: parsing the Windows directories by dasgar
in thread parsing the Windows directories by g_speran

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.