DirectoryHelper Class
From HD.Common
| DirectoryHelper Class | Helper帮助文档 |
文件夹帮助类
Inheritance Hierarchy
Namespace: HD.Common
Assembly: HD.Common (in HD.Common.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
public static class DirectoryHelper
Public NotInheritable Class DirectoryHelper
public ref class DirectoryHelper abstract sealed
[<AbstractClassAttribute>] [<SealedAttribute>] type DirectoryHelper = class end
The DirectoryHelper type exposes the following members.
Methods
| Name | Description | |
|---|---|---|
| AppendText |
向文本文件的尾部追加内容
| |
| ClearDirectory |
清空指定目录下所有文件及子目录,但该目录依然保存.
| |
| ClearFile |
清空文件内容
| |
| Contains(String, String) |
检测指定目录中是否存在指定的文件,若要搜索子目录请使用重载方法.
| |
| Contains(String, String, Boolean) |
检测指定目录中是否存在指定的文件
| |
| Copy |
将源文件的内容复制到目标文件中
| |
| CopyFile |
复制文件
| |
| CopyFolder |
复制文件夹(递归)
| |
| CreateDir |
创建目录
| |
| CreateDirectory |
创建一个目录
| |
| CreateFile(String) |
创建一个文件。
| |
| CreateFile(String, Byte) |
创建一个文件,并将字节流写入文件。
| |
| CreateFile(String, String) |
创建文件
| |
| DeleteDir |
删除目录
| |
| DeleteDirectory |
删除指定目录及其所有子目录
| |
| DeleteFile |
删除文件
| |
| DeleteFolderFiles |
删除指定文件夹对应其他文件夹里的文件
| |
| ExistsFile |
检查文件,如果文件不存在则创建
| |
| GetDateDir |
根据时间得到目录名yyyyMMdd
| |
| GetDateFile |
根据时间得到文件名HHmmssff
| |
| GetDirectories(String) |
获取指定目录中所有子目录列表,若要搜索嵌套的子目录列表,请使用重载方法.
| |
| GetDirectories(String, String, Boolean) |
获取指定目录及子目录中所有子目录列表
| |
| GetExtension |
从文件的绝对路径中获取扩展名
| |
| GetFileName |
从文件的绝对路径中获取文件名( 包含扩展名 )
| |
| GetFileNameNoExtension |
从文件的绝对路径中获取文件名( 不包含扩展名 )
| |
| GetFileNames(String) |
获取指定目录中所有文件列表
| |
| GetFileNames(String, String, Boolean) |
获取指定目录及子目录中所有文件列表
| |
| GetFileSize |
获取一个文件的长度,单位为Byte
| |
| GetLineCount |
获取文本文件的行数
| |
| IsEmptyDirectory |
检测指定目录是否为空
| |
| IsExistDirectory |
检测指定目录是否存在
| |
| IsExistFile |
检测指定文件是否存在,如果存在则返回true。
| |
| Move |
将文件移动到指定目录
| |
| MoveFile |
移动文件(剪贴--粘贴)
| |
| WriteText |
向文本文件中写入内容
|
See Also