in reply to Re: Unix File Type with stat
in thread Unix File Type with stat
And while I am admitting how much I don't know, what does the >>12 do in the array reference? Thanks.# hard code a test link file to check $source_file = "/temp/test/source/dir1/hello1_link.txt"; # define filetype array with potential first bits of mode @ftypes = qw(. p c ? d ? b ? - ? l ? s ? ? ?); $ftypes0 = ''; # Get File Statistics Using Scalar context ($dev,$inode,$mode,$nlink,$uid,$gid,$rdev,$size, $atime,$mtime,$ctime,$blksize,$blocks) = stat($source_file); $perms = $mode & 07777; $octperms = sprintf("%lo", $perms); $filetype = $ftypes[($mode & 0170000)>>12]; $filelink = $ftypes[($mode & 0120000)>>12];
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Unix File Type with stat
by Helter (Chaplain) on Sep 10, 2002 at 13:09 UTC | |
|
Re: Re: Unix File Type with stat
by Zaxo (Archbishop) on Sep 10, 2002 at 15:57 UTC |