
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
Renaming a File
|
679
In many cases, more than one of these flags can be set at one time, but see the
description for the
Normal flag, which must be used alone.
See Also
See the “File Class,” “FileInfo Class,” and “FileAttributes Enumeration” topics in the
MSDN documentation.
12.3 Renaming a File
Problem
You need to rename a file.
Solution
With all of the bells and whistles hanging off the .NET Framework, you would fig-
ure that renaming a file is easy. Unfortunately, there is no specific rename method
that can be used to rename a file. Instead, you can use the static
Move method of the
Table 12-1. FileAttributes enumeration values
Member name Description
Archive Represents the file’s archive status that marks the file for backup or removal.
Compressed Indicates that the file is compressed.
Device This option is reserved for future use.
Directory Indicates that this is a directory.
Encrypted Indicates that a file or directory is encrypted. In the case of a file, its contents are encrypted. In
the case of a directory, newly created files will be encrypted by default.
Hidden Indicates a hidden file.
Normal Indicates that the file has no other attributes; as such, this attribute cannot be used in combi-
nation with others.
NotContentIndexed Indicates that the file is excluded from the content index ...