NAME
MSDOS::Attrib - Get or set MS-DOS file attributes
SYNOPSIS
use MSDOS::Attrib qw(get_attribs set_attribs);
$attribs = get_attribs($path);
set_attribs($attribs, $path1, $path2, ...);
DESCRIPTION
MSDOS::Attrib provides access to MS-DOS file attributes. While the read-only attribute can be handled by chmod
and stat
, the hidden, system, and archive attributes cannot.
- $attribs = get_attribs($path)
-
Returns the attributes of
$path
, or the empty string if$path
does not exist. Attributes are returned as a five-character string in this format: "RHSAD". Each letter is replaced by an underscore (_
) if the file does not have the corresponding attribute. (This is the same format as a 4DOS directory listing.) The attributes are:R The file is read-only (not writable) H The file is hidden (does not appear in directory listings) S The file is a system file (does not appear in directory listings) A The file needs to be archived (it has changed since last backup) D The file is a directory
- $count = set_attribs($attribs, $path1, [$path2, ...])
-
Sets the attributes of
$path1
,$path2
, etc. You can either specify the complete set of attributes, or add and subtract attributes by using+
and-
. The case and order of the attributes is not important. For example, '-s+ra' will remove the system attribute and add the read-only and archive attributes. You should not use whitespace between attributes, although underscores are OK. Seeget_attribs
for an explanation of the attribute values. You cannot change the directory attribute; if you specify it, it is ignored. Returns the number of files successfully changed.
LICENSE
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See either the GNU General Public License or the Artistic License for more details.
AUTHOR
Christopher J. Madsen <chris_madsen@geocities.com>
SEE ALSO
The OS2::ExtAttr module provides access to extended attributes under OS/2.
The Win32::FileSecurity module provides access to Discretionary Access Control Lists under Windows NT.