加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

perl stat windows 与 UNIX不同

发布时间:2020-12-16 00:20:31 所属栏目:大数据 来源:网络整理
导读:在 windows perl 下运行如下程序: sub stat{?? ?my ($filename) = @_;?? ?my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksizes,$blocks) = stat($filename);?? ?print "filename is $filename:n"; ?? ?print "Dev is $dev,I

在 windows perl 下运行如下程序:

sub stat { ?? ?my ($filename) = @_; ?? ?my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksizes,$blocks) = stat($filename); ?? ?print "filename is $filename:n"; ?? ?print "Dev is $dev,Inode is $ino,Mode is $moden"; ?? ?print "nlink is $nlink,Uid is $uid,Gid is $gidn"; ?? ?print "rdev is $rdev,Size is $sizen"; ?? ?print "atime is $atime,mtime is $mtime,ctime is $ctimen"; ?? ?print "blkszies is $blksizes,blocks is $blocksn"; } sub get_stat { ?? ?foreach my $filename (@ARGV) ?? ?{ ?? ??? ?&stat($filename); ?? ?} }

&get_stat();

运行时输入:stat test.1 test.2

结果得到的Dev 和inode 两个文件是相同的。而在UNIX环境下,这两者可以唯一确定一个文件!

google了一下发现, stat 函数在 windows 中某些值是得不到的(某些值为0)!

1.) UNIX值的描述:

0 Device number of file system 1 Inode number 2 File mode (type and permissions) 3 Number of (hard) links to the file 4 Numeric user ID of file.s owner 5 Numeric group ID of file.s owner 6 The device identifier (special files only) 7 File size,in bytes 8 Last access time since the epoch 9 Last modify time since the epoch 10 Inode change time (not creation time!) since the epoch 11 Preferred block size for file system I/O 12 Actual number of blocks allocated window下值的描述
Table 10.2: stat Return Valves

Field

Description

dev

Device number (drive number)

ino

Inode number: 0 (zero) in Perl for Win32

mode

File permission mode: read/write/execute

nlink

Number of links to file (usually one for Win32 systems?- NTFS filesystems may have a value greater than one)

uid

User ID?- zero for Win32

gid

Group ID?- zero for Win32

rdev

Device Identifier (drive number)

size

File size in bytes

atime

Last access time (C lang. time_t value)

mtime

Last modification time (C lang. time_t value)

ctime

File creation time (C lang. time_t value)

blksize

Disk block size (cluster size): zero for Win32

blocks

Number of blocks for file: zero for Win32

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读