Perl 调用 SetAttributes 修改文件属性 (Windows)

2015-12-14 0 904
Perl 调用 SetAttributes 修改文件属性 (Windows)
use Win32::File;

Win32::File::SetAttributes($name, $attr);

#!/usr/bin/perl -w

use Win32::File;

$name  = "yourFile.txt";
$attr  = 0;

Win32::File::GetAttributes($name, $attr) or die "Can't get attributes for $name.";

print "File attributes: $attr\n";

if ($attr & READONLY) {
    print "$name is read only.\n";
}

if ($attr & ARCHIVE) {
    print "$name has ARCHIVE set.\n";
}

if ($attr & HIDDEN) {
    print "$name is hidden.\n";
}

if ($attr & SYSTEM) {
    print "$name has SYSTEM set.\n";
}

if ($attr & COMPRESSED) {
    print "$name has COMPRESSED set.\n";
}

if ($attr & DIRECTORY) {
    print "$name has DIRECTORY set.\n";
}

if ($attr & NORMAL) {
    print "$name has NORMAL set.\n";
}

if ($attr & OFFLINE) {
    print "$name has OFFLINE set.\n";
}

if ($attr & TEMPORARY) {
    print "$name has TEMPORARY set.\n";
}

遇见资源网 perl Perl 调用 SetAttributes 修改文件属性 (Windows) http://www.ox520.com/13221.html

上一篇:

已经没有上一篇了!

下一篇:

已经没有下一篇了!

常见问题

相关文章

发表评论
暂无评论
官方客服团队

为您解决烦忧 - 24小时在线 专业服务