Search the path from a specific keyword.(通过关键词来推测路径)
PathExtensions
01 Syntax
02 Methods
| Name | Overloads | Summary |
|---|---|---|
| ChangeSuffix | 1 | 修改路径字符串之中的文件名后缀拓展名为newSuffix指定的值。newSuffix不需要添加小数点 |
| DeleteFile | 1 | Execute file delete |
| ExtensionSuffix | 2 | Test if is there any given extension name is equals to the extension name of the specific file path. |
| DIR | 1 | Combine directory path.(这个主要是用于生成文件夹名称) ###### Example usage vbnet Dim images As Dictionary(Of String, String) = (ls - l - {"*.png", "*.jpg", "*.gif"} <= PlatformEngine.… |
| MakeDir | 1 | Make directory |
| EnumerateFiles | 1 | 使用FileSystem.GetFiles())函数枚举 当前的(不是递归的搜索所有的子文件夹)文件夹之中的 所有的符合条件的文件路径 |
| ListFiles | 1 | ls - l - r - pattern <= DIR 的简化拓展函数模式 |
| ReadDirectory | 1 | 这个函数是会直接枚举出所有的文件路径的 |
| ListDirectory | 1 | Yield subfolders' FullName |
| TheFile | 1 | 这个函数只会返回文件列表之中的第一个文件,故而需要提取某一个文件夹之中的某一个特定的文件,推荐使用这个函数(这个函数默认只查找第一级文件夹,不会进行递归搜索) |
| ToFileURL | 1 | Gets the URL type file path. |
| NormalizePathString | 1 | 将目标字符串之中的非法的字符替换为"_"符号以成为正确的文件名字符串。当参数alphabetOnly为真的时候,意味着所有的非字母或者数字的字符都会被替换为下划线,默认为真 |
| Long2Short | 1 | 假设文件名过长发生在文件名和最后一个文件夹的路径之上 |
| PathIllegal | 1 | File path illegal? |
| FileLength | 1 | Gets the file length, if the path is not exists, then returns -1. |
| FileCopy | 1 | Safe file copy operation. |
| FileExists | 1 | Check if the target file object is exists on your file system or not. |
| DirectoryExists | 1 | Determine that the target directory is exists on the file system or not? |
| DirectoryName | 1 | Get the directory its name of the target dir directory |
| FileOpened | 1 | Check if the file is opened by other code?(检测文件是否已经被其他程序打开使用之中) |
| BaseName | 1 | Gets the name of the target file or directory, if the target is a file, then the name without the extension suffix name. |
| ParentDirName | 1 | Gets the name of the file's parent directory, returns value is a name, not path. |
| ParentPath | 1 | Returns the directory path value of the parent directory. |
| RelativePath | 2 | Gets the relative path of file system object pcTo reference to the directory path pcFrom. |
| GetFullPath | 1 | Gets the full path of the specific file. |
| CheckUNCNetworkPath | 1 | Check of this given windows file path is in UNC full path style? |
| GetDirectoryFullPath | 1 | Gets the full path of the specific directory. |
| TrimSuffix | 1 | Removes the file extension name from the file path. |
| TrimDIR | 1 | Removes the last \ and / character in a directory path string. |
| FileName | 1 | 返回文件名称.拓展名,对于文件夹路径而言,则是返回文件夹名称 |
| SafeCopyTo | 1 | 进行安全的复制,出现错误不会导致应用程序崩溃,大文件不推荐使用这个函数进行复制 |
| SplitPath | 1 | |
| UnixPath | 1 | |
| PathCombine | 1 | |
| ToDIR_URL | 1 | |
| FileMove | 1 |
03 Fields
| Name | Overloads | Summary |
|---|---|---|
| ILLEGAL_PATH_CHARACTERS | 2 | 枚举所有非法的路径字符 |
| DriveLabel | 1 | + C:\ + AB:\ + AB2:\ + etc... |
| UNCprefixRegexp | 1 | regexp pattern for matches the UNC path prefix string. |
| ILLEGAL_FILENAME_CHARACTERS | 1 |
04 Members
String, String)修改路径字符串之中的文件名后缀拓展名为newSuffix指定的值。newSuffix不需要添加小数点
| Name | Type | Description |
|---|---|---|
path$ | String | - |
newSuffix$ | String | 新的文件拓展名,这个拓展名不带有小数点,例如需要修改为*.csv,则直接赋值csv即可 |
String, Boolean, Boolean, Action(Of Object))Execute file delete
| Name | Type | Description |
|---|---|---|
path | String | The file path or the directory path. |
throwEx | Boolean | - |
strictFile | Boolean | this function is not allowed for delete a directory by default. |
String)returns a file extension suffix name in lower case.
this is a safe function, which mean the value Nothing will never be returns from this function.
(函数返回文件的拓展名后缀,请注意,这里的返回值是不会带有小数点的)
| Name | Type | Description |
|---|---|---|
path | String | the file path string |
returns a file extension suffix name in lower case, if there is no extension name or path string is empty, then empty string value will be returned.
String, String())Test if is there any given extension name is equals to the extension name of the specific file path.
case ignored
| Name | Type | Description |
|---|---|---|
path | String | - |
isAny | String() | 不带小数点的文件拓展名列表 |
DirectoryInfo, String)Combine directory path.(这个主要是用于生成文件夹名称)
Example usage
Dim images As Dictionary(Of String, String) =
(ls - l - {"*.png", "*.jpg", "*.gif"} <= PlatformEngine.wwwroot.DIR("images")) _
.ToDictionary(Function(file) file.StripAsId,
AddressOf FileName)| Name | Type | Description |
|---|---|---|
d | DirectoryInfo | - |
name | String | - |
String, Boolean)Make directory
| Name | Type | Description |
|---|---|---|
dir | String | - |
String, String())使用FileSystem.GetFiles()函数枚举 当前的(不是递归的搜索所有的子文件夹)文件夹之中的 所有的符合条件的文件路径
| Name | Type | Description |
|---|---|---|
dir | String | 文件夹路径 |
keyword | String() | Default is |
a collection of file full paths
String, String()) ls - l - r - pattern <= DIR
的简化拓展函数模式
| Name | Type | Description |
|---|---|---|
directory | String | - |
pattern | String() | default filter is |
scan for all sub-folder in recursive mode.
String, SearchOption)这个函数是会直接枚举出所有的文件路径的
| Name | Type | Description |
|---|---|---|
DIR$ | String | - |
[option] | SearchOption | - |
String, SearchOption, Boolean)Yield subfolders' FullName
| Name | Type | Description |
|---|---|---|
DIR | String | 文件夹不存在,则返回空的列表 |
[option] | SearchOption | - |
String, String, SearchOption, Boolean)这个函数只会返回文件列表之中的第一个文件,故而需要提取某一个文件夹之中的某一个特定的文件,推荐使用这个函数(这个函数默认只查找第一级文件夹,不会进行递归搜索)
| Name | Type | Description |
|---|---|---|
DIR$ | String | - |
keyword$ | String | - |
opt | SearchOption | - |
wildcard | Boolean | The keyword parameter value is a wildcard. |
当查找不到目标文件或者文件夹不存在的时候会返回空值
String)Gets the URL type file path.
(获取URL类型的文件路径)
| Name | Type | Description |
|---|---|---|
Path | String | - |
String, Boolean, String)将目标字符串之中的非法的字符替换为"_"符号以成为正确的文件名字符串。当参数alphabetOnly为真的时候,意味着所有的非字母或者数字的字符都会被替换为下划线,默认为真
| Name | Type | Description |
|---|---|---|
str | String | - |
alphabetOnly | Boolean | 当本参数为真的时候,仅26个字母,0-9数字和下划线_以及小数点可以被保留下来 |
String, String)假设文件名过长发生在文件名和最后一个文件夹的路径之上
System.IO.PathTooLongException: The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
| Name | Type | Description |
|---|---|---|
path | String | - |
String)File path illegal?
| Name | Type | Description |
|---|---|---|
path | String | - |
String)Gets the file length, if the path is not exists, then returns -1.
(安全的获取文件的大小,如果目标文件不存在的话会返回-1)
| Name | Type | Description |
|---|---|---|
path | String | - |
String, String)Safe file copy operation. (请注意,copyTo参数的字符串最末尾必须是/或者\才会被认作为目录路径)
| Name | Type | Description |
|---|---|---|
source$ | String | - |
copyTo$ | String | Can be file name or directory name.
Please notice that, the directory path should end with path seperator symbol: |
String, Boolean)Check if the target file object is exists on your file system or not. (这个函数也会自动检查目标path参数是否为空)
| Name | Type | Description |
|---|---|---|
path | String | - |
ZERO_Nonexists | Boolean | 将0长度的文件也作为不存在 |
returns the file path check result:
- path string is null or empty string: false
- file not exists: false
- file is zero length andalso ZERO_Nonexists is config as true: false
String)Determine that the target directory is exists on the file system or not?
(判断文件夹是否存在)
| Name | Type | Description |
|---|---|---|
DIR | String | - |
- for directory parameter DIR is nothing or empty string: return false
- for directory not exists: return false
String)Get the directory its name of the target dir directory
| Name | Type | Description |
|---|---|---|
dir$ | String | - |
String)Check if the file is opened by other code?(检测文件是否已经被其他程序打开使用之中)
| Name | Type | Description |
|---|---|---|
FileName | String | 目标文件 |
String, Boolean)Gets the name of the target file or directory, if the target is a file, then the name without the extension suffix name.
2017-2-14
原先的函数是依靠系统的API来工作的,故而只能够工作于已经存在的文件之上, 所以在这里为了更加方便的兼容文件夹或者文件路径,在这使用字符串的方法来 进行截取
获取目标文件夹的名称或者文件的不包含拓展名的名称
String)Gets the name of the file's parent directory, returns value is a name, not path. (获取目标文件的父文件夹的文件夹名称,是名称而非路径)
| Name | Type | Description |
|---|---|---|
file | String | - |
String, Boolean)Returns the directory path value of the parent directory. (这个函数是返回文件夹的路径而非名称,这个函数不依赖于系统的底层API, 因为系统的底层API对于过长的文件名会出错)
this function also could be used for handling of the http url location. 这个函数不依赖于系统的底层API,因为系统的底层API对于过长的文件名会出错
| Name | Type | Description |
|---|---|---|
file | String | - |
full | Boolean | http url should turn this parameter to false? |
String)Get the specific file system object its relative path to the application base directory.
(获取相对于本应用程序的目标文件的相对路径(请注意,所生成的相对路径之中的字符串最后是没有文件夹的分隔符\或者/的))
| Name | Type | Description |
|---|---|---|
path | String | - |
String, String, Boolean, Boolean)Gets the relative path of file system object pcTo reference to the directory path pcFrom.
(请注意,所生成的相对路径之中的字符串最后是没有文件夹的分隔符\或者/的)
| Name | Type | Description |
|---|---|---|
pcFrom | String | 生成相对路径的参考文件夹 |
pcTo | String | 所需要生成相对路径的目标文件系统对象的绝对路径或者相对路径 |
appendParent | Boolean | 是否将父目录的路径也添加进入相对路径之中?默认是 |
The relative path string of pcTo file object reference to directory pcFrom
String, Boolean)Gets the full path of the specific file.
(为了兼容Linux,这个函数会自动替换路径之中的\为/符号)
| Name | Type | Description |
|---|---|---|
file | String | - |
String)Check of this given windows file path is in UNC full path style?
| Name | Type | Description |
|---|---|---|
path | String | check of this given path is a UNC path or not? UNC full path is a kind of network path for smb network drive, example as \\192.168.3.1\XXX, the UNC path is prefixed with a server ip address. |
String, String)Gets the full path of the specific directory.
(这个函数为了兼容linux的文件系统,也会自动的将所有的\替换为/)
| Name | Type | Description |
|---|---|---|
dir | String | - |
stack | String | 当程序出错误的时候记录进入日志的一个追踪目标参数,调试用 |
String)Removes the file extension name from the file path.
(去除掉文件的拓展名)
| Name | Type | Description |
|---|---|---|
file | String | - |
String)Removes the last \ and / character in a directory path string.
(使用这个函数修剪文件夹路径之中的最后一个分隔符,以方便生成文件名)
| Name | Type | Description |
|---|---|---|
DIR | String | - |
String)返回文件名称.拓展名,对于文件夹路径而言,则是返回文件夹名称
这个函数为单纯的字符串解析函数,不依赖于文件系统的API
| Name | Type | Description |
|---|---|---|
path | String | - |
String, String)进行安全的复制,出现错误不会导致应用程序崩溃,大文件不推荐使用这个函数进行复制
| Name | Type | Description |
|---|---|---|
source | String | - |
copyTo | String | - |
枚举所有非法的路径字符
- C:\
- AB:\
- AB2:\
- etc...
regexp pattern for matches the UNC path prefix string.
String)String)String, String)String)String, String)