Sometimes we need to process some attributes of the file, such as read-only and hidden,
Here I will explain how to obtain and modify the attributes of a file in Win32.
Required: Use Win32: file;
Use the following method:
My $ set;
# Retrieving file attributes
Win32: file: getattributes ($ name, $ set );
# Setting file attributes
Win32: file: setattributes ($ name, archive );
In perldoc, the attributes that can be set are as follows:
-
archive archive file 32
-
compressed compressed file 2048
-
directory directory file 16
-
hidden hides file 2
-
normal normal file 128
-
offline offline file 4096
-
readonly Read-Only file 1
-
System System File 4
-
temporary temporary file 256
-
-
For the sake of understanding, I In the Program , the corresponding values of each option are printed and attached to the backend,
-
-
Each option occupies only one place, so we can use or | to apply multiple attributes at the same time, as shown below:
-
-
Win32: file: setattributes ($ name,
archive |
hidden );
-
-
In this way, you will find that your files are hidden and archived at the same time. ^_^
-
-
-
Retained the following information:
author (author): smilelance
time: 2006.08.11
-
Source (from): http://blog.csdn.net/smilelance