bitte schön
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
use Win32::File;
use strict;
my %Win32FileAttrTypes =
(
FILE_ATTRIBUTE_READONLY => 0x00000001,
FILE_ATTRIBUTE_HIDDEN => 0x00000002,
FILE_ATTRIBUTE_SYSTEM => 0x00000004,
FILE_ATTRIBUTE_DIRECTORY => 0x00000010,
FILE_ATTRIBUTE_ARCHIVE => 0x00000020,
FILE_ATTRIBUTE_DEVICE => 0x00000040,
FILE_ATTRIBUTE_NORMAL => 0x00000080,
FILE_ATTRIBUTE_TEMPORARY => 0x00000100,
FILE_ATTRIBUTE_SPARSE_FILE => 0x00000200,
FILE_ATTRIBUTE_REPARSE_POINT => 0x00000400,
FILE_ATTRIBUTE_COMPRESSED => 0x00000800,
FILE_ATTRIBUTE_OFFLINE => 0x00001000,
FILE_ATTRIBUTE_NOT_CONTENT_INDEXED => 0x00002000,
FILE_ATTRIBUTE_ENCRYPTED => 0x00004000,
);
my %Win32FileAttrNames = reverse %Win32FileAttrTypes;
my $attr;
Win32::File::SetAttributes("c:\\uhu.pl", $attr | $Win32FileAttrTypes{FILE_ATTRIBUTE_ARCHIVE});
Win32::File::GetAttributes("c:\\uhu.pl", $attr);
DumpAttr($attr);
Win32::File::SetAttributes("c:\\uhu.pl", $attr & ~$Win32FileAttrTypes{FILE_ATTRIBUTE_ARCHIVE});
Win32::File::GetAttributes("c:\\uhu.pl", $attr);
DumpAttr($attr);
sub DumpAttr
{
my ($attr) = @_;
foreach (keys %Win32FileAttrNames)
{
print "$Win32FileAttrNames{$_}\n" if $attr & $_;
}
print "\n";
}
\n\n
<!--EDIT|esskar|1061986234-->