perl stat windows 与 UNIX不同
来源:互联网 发布:米德尔顿 知乎 编辑:程序博客网 时间:2024/04/26 09:06
在 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 $mode\n"; print "nlink is $nlink, Uid is $uid, Gid is $gid\n"; print "rdev is $rdev, Size is $size\n"; print "atime is $atime, mtime is $mtime, ctime is $ctime\n"; print "blkszies is $blksizes, blocks is $blocks\n";}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 system1 Inode number2 File mode (type and permissions)3 Number of (hard) links to the file4 Numeric user ID of file.s owner5 Numeric group ID of file.s owner6 The device identifier (special files only)7 File size, in bytes8 Last access time since the epoch9 Last modify time since the epoch10 Inode change time (not creation time!) since the epoch11 Preferred block size for file system I/O12Actual number of blocks allocatedwindow下值的描述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
- perl stat windows 与 UNIX不同
- 在Windows上用Perl模拟Unix的Which命令
- 用perl获取linux,unix,windows平台ip的程序
- 【Unix】Unix与Windows编程对比一览
- windows与unix体系结构图
- windows与unix体系结构图
- Windows 与 Unix 体系结构图
- Windows 与 Unix 体系结构图
- windows与unix体系结构图
- windows与unix文本文件格式
- windows与unix文件格式转换
- Unix学习笔记------Stat函数与chmod函数的配合使用
- perl下stat()函数的使用
- JDK不同操作系统的FileSystem(Windows&Unix-like)
- JDK不同操作系统的FileSystem(Windows&Unix-like)
- Linux与windows的不同
- Linux与Windows的不同
- Linux与Windows的不同
- Js获取当前日期时间及其它操作
- struts2.3.4应用开发小结(1)
- SQL日期比较
- 11 个惊人的 CSS3 和 jQuery 制作的教程收集
- Notification使用详解之二:可更新进度的通知
- perl stat windows 与 UNIX不同
- “菜单”“定义”“嵌套”列表
- Latex 中文章节
- VS2010下实现一个简单的Windows程序
- JavaScript confirm应用实例
- C++学习笔记之模板
- Ubuntu下载地址
- 移植libjingle v0.5x for IOS(iphone device + iphone simulator)
- (CUDA 编程1).CUDA 线程执行模型分析(一)招兵 ------ GPU的革命