NAME

MSDOS::Attrib - Get or set MS-DOS file attributes

VERSION

This document describes version 1.06 of MSDOS::Attrib, released September 6, 2014.

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. See get_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.

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.

The Win32::File module provides similar functionality to MSDOS::Attrib, but with a different (and in my opinion clunkier) interface.

CONFIGURATION AND ENVIRONMENT

MSDOS::Attrib requires no configuration files or environment variables.

INCOMPATIBILITIES

None reported.

BUGS AND LIMITATIONS

No bugs have been reported.

AUTHOR

Christopher J. Madsen <perl AT cjmweb.net>

Please report any bugs or feature requests to <bug-MSDOS-Attrib AT rt.cpan.org> or through the web interface at http://rt.cpan.org/Public/Bug/Report.html?Queue=MSDOS-Attrib.

You can follow or contribute to MSDOS-Attrib's development at https://github.com/madsen/msdos-attrib.

COPYRIGHT AND LICENSE

This software is copyright (c) 2014 by Christopher J. Madsen.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

DISCLAIMER OF WARRANTY

BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.

IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENSE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.