TDirectory.GetParent获取指定目录的父目录
使用函数:
System.IOUtils.TDirectory.GetParent
class function GetParent(const Path: string): string; static;
说明:返回给定目录的父目录,相对路径则为当前工作路径
异常处理:指定目录不存在或无效
代码:
procedure TForm1.Button1Click(Sender: TObject);
begin
try
//获取指定目录的父目录
//异常:指定目录不存在或无效
ShowMessage(Edit1.Text + '的父目录为:' + TDirectory.GetParent(Trim(Edit1.Text)));
except
on e: Exception do
begin
MessageDlg(e.ClassName + ' : ' + e.Message, mtError, [mbok], );
Exit;
end;
end;
end;

TDirectory.GetParent获取指定目录的父目录的更多相关文章
- TDirectory.GetFileSystemEntries获取指定目录下的目录和文件
使用函数: System.IOUtils.TDirectory.GetFileSystemEntries 所有重载: class function GetFileSystemEntries(const ...
- TDirectory.GetFiles获取指定目录下的文件
使用函数: System.IOUtils.TDirectory.GetFiles 所有重载: class function GetFiles(const Path: string): TStringD ...
- TDirectory.GetDirectories 获取指定目录下的目录
使用函数: System.IOUtils.TDirectory.GetDirectories 所有重载: class function GetDirectories(const Path: strin ...
- TDirectory.GetDirectoryRoot获取指定目录的根目录
使用函数: System.IOUtils.TDirectory.GetDirectoryRoot 函数定义: class function GetDirectoryRoot(const Path: s ...
- TDirectory.GetLastAccessTime获取指定目录最后访问时间
使用函数: System.IOUtils.TDirectory.GetLastAccessTime 函数定义: class function GetLastAccessTime(const Path: ...
- win32命令行小程序获取指定文件夹或者目录下面的所有文件大小,文件数量,目录数量
#include <Windows.h> #include <stdio.h> #include <tchar.h> LARGE_INTEGER lgA ...
- [Win32]获取指定进程的父进程PID
// // #include <Windows.h> #include <winnt.h> #include <winternl.h> typedef NTSTAT ...
- C# 如何获取当前应用程序的父目录
//获取当前运行路径的上级目录(父目录) System.IO.DirectoryInfo topDir = System.IO.Directory.GetParent(System.Environme ...
- php获取父目录的方法 dirname()
dirname() 方法,获取父目录的方法,官方文档:http://php.net/manual/en/function.dirname.php 在 php 7.0 后,dirname() 支持两个参 ...
随机推荐
- 自助用户选择VM Network
在VMM中为用户所属角色分配“作者VM网络”权限后,用户才可以在部署虚机的选择不同的VM Network,否则用户只能使用模板上所使用的VM Network,无法进行选择
- 新建共享,NTFS权限设置
1. Overview Some time ago, I was automating a few tasks with PowerShell and needed to set NTFS permi ...
- Python邮箱客户端编写之接收邮件操作
Python的POP3类有很多方法来管理邮箱. 首先需要导入poplib库,import poplib POP3(server) 连接到邮箱服务器 user(username)将用户名发送至服务器,等 ...
- windows API 实现截图
參考:http://bbs.csdn.net/topics/330154355 #include "stdio.h" #include "windows.h" ...
- 【转】oracle创建表空间
原文:http://www.cnblogs.com/netsql/articles/1745978.html 注意点: 1.如果在PL/SQL 等工具里打开的话,直接修改下面的代码中[斜体加粗部分]执 ...
- [React] React Fundamentals: State Basics
State is used for properties on a component that will change, versus static properties that are pass ...
- iOS开发技巧(系列十八:扩展UIColor,支持十六进制颜色设置)
新建一个Category,命名为UIColor+Hex,表示UIColor支持十六进制Hex颜色设置. UIColor+Hex.h文件, #import <UIKit/UIKit.h> # ...
- Linux内核里的DebugFS
DebugFS,顾名思义,是一种用于内核调试的虚拟文件系统,内核开发者通过debugfs和用户空间交换数据.类似的虚拟文件系统还有procfs和sysfs等,这几种虚拟文件系统都并不实际存储在硬盘上, ...
- yum在线升级
RPM优点 由於 RPM 是透过预先编译并打包成为 RPM 文件格式后,再加以安装的一种方式,并且还能够进行数据库的记载. 所以 RPM 有以下的优点: RPM 内含已经编译过的程序与配置档等数据,可 ...
- Http协议三次握手过程
TCP(Transmission Control Protocol) 传输控制协议 TCP是主机对主机层的传输控制协议,提供可靠的连接服务,采用三次握手确认建立一个连接: 位码即tcp标志位,有6种标 ...