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() 支持两个参 ...
随机推荐
- C#基础知识-对象初始化顺序
本文章转载:http://blog.csdn.net/forever_wind/article/details/7442503 不错的文章:http://www.cnblogs.com/McJerem ...
- 函数(Function)作用域 / 远程函数执行
函数跟变量一样也是有作用域的:Global.Script.Local.Private Global:作用于整个PowerShell会话,只要PowerShell会话不结束,被Global修饰的变量和函 ...
- jQuery获取Select选中的Text和Value,根据Value值动态添加属性
语法解释:1. $("#select_id").change(function(){//code...}); //为Select添加事件,当选择其中一项时触发2. var chec ...
- 深入浅出JMS(一)——JMS简单介绍
假设手机仅仅能进行实时通话,没有留言和短信功能会怎么样?一个电话打过来,正好没有来得及接上,那么这个电话要传递的信息肯定就收不到了.为什么不能先将信息存下来,当用户须要查看信息的时候再去获得信息呢?伴 ...
- CardsTube/YouTubePlaylist
CardsTube https://github.com/DesarrolloAntonio/CardsTube YouTubePlaylist https://github.com/akoscz/Y ...
- JSON数据的中文乱码问题
问题描述: 在firefox中返回的JSON数据没有出现乱码,但在GridPanel中显示乱码,而jsp页面和xml文件都是utf-8类型. 解决方案: 在 PrintWriter out = res ...
- MVC - 身份验证
FormsAuthenticationTicket 使用此类来为用户生成一个身份票据 持有该票据则说明该用户是通过了身份验证的用户 可以随时访问某些资源 我们先创建几个类 //用户 public c ...
- flash解析json格式
flash对于json格式的解析在Flash CS6的版本对于json格式的数据提供了支持,用以下方式即可以进行转换: var persons = JSON.parse('[{"name&q ...
- SMTP ERROR: Password command failed: 535 Incorrect authentication data
在处理一个使用PHPMailer来发送电邮,我在本地使用我的163邮箱来做测试发送电邮,能够成功的发送电邮:当上传到正式平台时,出现了,类似这样的错误信息 SMTP ERROR: Password c ...
- ASP.Net中GridView多层嵌套,用最里层的控件获取到外层GridView
protected void ddlCode_SelectedIndexChanged(object sender, EventArgs e) { DropDownList ddlCode = (Dr ...