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() 支持两个参 ...
随机推荐
- ubuntu14.04中安装QuartusII9.1步骤
家里的计算机安装了WIN10,出于够用且安装文件小,想安装QuartusII9.1,按M$风格,驱动绝对是安不上的.正好是双系统ubuntu14.04 64位.安装过程不太顺利,记录下来,当作已经不灵 ...
- JSON.NET概述
1. JSON.NET概述 当JSON逐渐成为Ajax的标准数据交互格式时,在.NET中处理JSON数据只能使用字符串拼接的方法,十分麻烦,因而催生了JSON.NET这个项目. JSON.NET是一个 ...
- c#中cookies的存取操作
在客户端创建一个username的cookies,其值为gjy,有效期为1天. 方法1: Response.Cookies["username"].Value="zxf& ...
- 为 vsftpd 启动 vsftpd:500 OOPS: bad bool value in config file for: pasv_enable
每行的值都不要有空格,否则启动时会出现错误,举个例子,假如我在listen=YES后多了个空格,那我启动时就出现.. 为 vsftpd 启动 vsftpd:500 OOPS: bad bool val ...
- 单核CPU,多线程与性能
问题概述 单核CPU的计算机上, 多线程能够提高程序运行的性能吗? 这个问题看起来简单,实际很复杂,设计到多方面的因素. 首先我们要把概念搞清楚, 那就是什么是性能? 一般来说, 我们把运行一个任 ...
- vim乱码处理
编辑~/.vimrc文件,加上如下几行: set fileencodings=utf-8set termencoding=utf-8set encoding=utf-8
- java.sql.SQLException: Before start of result set
在使用JDBC查询数据库报了这么一个错误 CREATE TABLE `d_user` ( `id` int(10) NOT NULL, `name` varchar(10) DEFAULT NULL, ...
- 移动端 touch 实现 拖动元素
var homeMove = (function () { //touch自适应 var k = "ontouchend" in window ? "touchend&q ...
- iframe父子窗口取值
父窗口中操作iframe:window.frames["iframeChild"].document //假如iframe的id为iframeChild 在子窗口中操作父窗口:wi ...
- Unity3D 之UGUI 面板
UGUI中使用面板,可以对一组控件分为一个组. 一个面板里面可以添加一些控件,就如同Html中的<div>一样.