使用函数:

  System.IOUtils.TDirectory.IsEmpty

class function IsEmpty(const Path: string): Boolean; static;

说明:参数为给定目录,返回布尔值

异常处理:指定目录为空或无效

代码:

var
sDir: string;
procedure TForm1.Button1Click(Sender: TObject);
begin
if not SelectDirectory('', 'H:\', sDir) then
Exit;
end; procedure TForm1.Button_CheckClick(Sender: TObject);
begin
try
if TDirectory.IsEmpty(sDir) then
begin
ShowMessage('此目录为空。');
Exit;
end;
ShowMessage('此目录不为空。');
except
on e: Exception do
begin
MessageDlg(e.ClassName + ' : ' + e.Message, mtError, [mbok], );
Exit;
end;
end;
end;

TDirectory.IsEmpty判断指定目录是否为空的更多相关文章

  1. TDirectory.GetParent获取指定目录的父目录

    使用函数: System.IOUtils.TDirectory.GetParent class function GetParent(const Path: string): string; stat ...

  2. TDirectory.GetLastAccessTime获取指定目录最后访问时间

    使用函数: System.IOUtils.TDirectory.GetLastAccessTime 函数定义: class function GetLastAccessTime(const Path: ...

  3. TDirectory.GetDirectoryRoot获取指定目录的根目录

    使用函数: System.IOUtils.TDirectory.GetDirectoryRoot 函数定义: class function GetDirectoryRoot(const Path: s ...

  4. TDirectory.GetFileSystemEntries获取指定目录下的目录和文件

    使用函数: System.IOUtils.TDirectory.GetFileSystemEntries 所有重载: class function GetFileSystemEntries(const ...

  5. TDirectory.GetFiles获取指定目录下的文件

    使用函数: System.IOUtils.TDirectory.GetFiles 所有重载: class function GetFiles(const Path: string): TStringD ...

  6. TDirectory.GetDirectories 获取指定目录下的目录

    使用函数: System.IOUtils.TDirectory.GetDirectories 所有重载: class function GetDirectories(const Path: strin ...

  7. 119、Java中String类之通过isEmpty判断是否为空字符串

    01.代码如下: package TIANPAN; /** * 此处为文档注释 * * @author 田攀 微信382477247 */ public class TestDemo { public ...

  8. Zip文件压缩(加密||非加密||压缩指定目录||压缩目录下的单个文件||根据路径压缩||根据流压缩)

    1.写入Excel,并加密压缩.不保存文件 String dcxh = String.format("%03d", keyValue); String folderFileName ...

  9. 微软BI 之SSIS 系列 - 在 SSIS 中将指定目录下的所有文件分类输出到不同文件夹

    开篇介绍 比如有这样的一个需求,旧的一个业务系统通常将产出的文件输出到同一个指定的目录下的不同子目录,输出的文件类型有 XML,EXCEL, TXT 这些不同后缀的文件.现在需要在 SSIS 中将它们 ...

随机推荐

  1. Windows环境下安装Ionic

    1. 首先要安装node环境,Ionic的安装和后续的许多前端工具的安装都依赖于node的包管理器npm. nodeJs环境的安装很简单,去官网下载最新版的NodeJs直接安装即可.      Nod ...

  2. Oracle--SQL Developer创建连接及使用

    安装好Oracle之后,有几种方式可以来管理Oracle中的数据库,首先就是登陆网页版的界面:https://localhost:1158/em,这种方式管理的东西太多,使用起来有点不方便,第二种方式 ...

  3. Spring Batch Framework– introduction chapter(下)

    Extract,Transform, and load(ETL) Briefly stated, ETL is a process in the database anddata-warehousin ...

  4. CopyU!下一次更新将增加对设备厂商及型号的识别!

    CopyU!下一版本的更新将加入对设备厂商及型号的识别功能,当用户连接设备时,CopyU!将能够辨别出设备的详细型号等,能够在一定程度上帮助用户发现问题设备或仿冒设备. 敬请期待即将到来的新更新!

  5. spring quartz的触发器CrontriggerBean配置

    每一个quartz的CronTrigger表达式分为七个子表达式,每个子表达式之间用空号分割,分别是:秒 分 时 日 月 星期 年.其中年不是必须的,所以CronTrigger最少有六个子表达式. 每 ...

  6. Python模拟键盘输入和鼠标操作

    Python模拟键盘输入和鼠标操作 一.Python键盘输入模拟: import win32api import win32con win32api.keybd_event(17,0,0,0)  #c ...

  7. nofollow标签如何使用

    “nofollow”的意思是不传递权重,向网站站长提供了一种方式,即告诉搜索引擎“不要追踪此网页上的链接”或“不要追踪此特定链接”. nofllow的形式 1.<meta name=" ...

  8. css-01

    1.CSS:级联样式表,设置页面的样式 2.css基本的语法:     属性:值; 3.CSS的引入   |-1.元素内容的引入:内联样式       <元素名 style="属性:值 ...

  9. win7系统玩游戏不能全屏的解决办法

    1.修改注册表中的显示器的参数设置   Win键+R键,打开运行窗口,输入regedit回车,这样就打开了注册表编辑器,然后,定位到以下位置:   HKEY_LOCAL_MACHINE\SYSTEM\ ...

  10. android开发者博客二月Android Studio2.0测试

    参考网页-http://android-developers.blogspot.com/2016/02/android-studio-20-beta.html Android Studio 2.0-B ...