TDirectory.GetCreationTime、TDirectory.SetCreationTime获取和设置文件夹创建时间
使用函数:
System.IOUtils.TDirectory.GetCreationTime//获取创建时间
System.IOUtils.TDirectory.SetCreationTime//设置创建时间
注:UTC结尾的返回 <Coordinated Universal Time即协调世界时>。
示例:

代码
unit Unit1; interface uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.FileCtrl, System.IOUtils; type
TForm1 = class(TForm)
Button_GetCreateTime: TButton;
Button_SetCreateTime: TButton;
Edit_Time: TEdit;
Button_ChooseFolder: TButton;
Label_Path: TLabel;
Memo1: TMemo;
procedure Button_ChooseFolderClick(Sender: TObject);
procedure Button_GetCreateTimeClick(Sender: TObject);
procedure Button_SetCreateTimeClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end; var
Form1: TForm1; implementation {$R *.dfm}
var
sDir: string;
procedure TForm1.Button_ChooseFolderClick(Sender: TObject);
begin
if not SelectDirectory('请选择一个文件夹', 'H:\', sDir) then Exit;
Label_Path.Caption := sDir;
Button_SetCreateTime.Enabled := True;
Button_GetCreateTime.Enabled := True;
end; procedure TForm1.Button_GetCreateTimeClick(Sender: TObject);
var
CTime: TDateTime;
begin
//
try
CTime := TDirectory.GetCreationTime(Label_Path.Caption);
Edit_Time.Text := DateTimeToStr(CTime); except
on e: Exception do
begin
MessageDlg('获取失败!' + e.Message, mtError, [mbok], );
Exit;
end;
end;
end; procedure TForm1.Button_SetCreateTimeClick(Sender: TObject);
begin
try
TDirectory.SetCreationTime(Label_Path.Caption, StrToDateTime(Edit_Time.Text));
except
on e1: Exception do
begin
MessageDlg('设置失败!' + e1.Message, mtError, [mbok], );
Exit;
end;
end;
end; end.
TDirectory.GetCreationTime、TDirectory.SetCreationTime获取和设置文件夹创建时间的更多相关文章
- 目录和文件 按创建时间排序du -h --time --max-depth=1 . |sort -r -t $'\t' -k 2 Linux查看文件夹大小,并按文件夹创建时间排序
目录和文件 按创建时间排序 # du -h --time --max-depth=1 . |sort -r -t $'\t' -k 230M 2020-04-01 14:54 .28K 2020-04 ...
- TDirectory.GetAttributes、TDirectory.SetAttributes获取和设置文件夹属性
使用函数: System.IOUtils.TDirectory.GetAttributes//获取属性 System.IOUtils.TDirectory.SetAttributes//设置属性 注: ...
- C#文件和文件文件夹按时间、名称排序-顺序与倒序
对于文件和文件夹有多种排序方式,常用的就是按创建或修改时间.按文件名排序.在 C# 中,按时间和文件名排序都十分简单,用数组提供的排序方法 Array.Sort() 一行代码就可以搞定,当然也可以用常 ...
- Java根路径设置(在获取本地路径时会获取到这个文件夹,,这样就可以专门放配置文件了)
在获取本地路径时会获取到这个文件夹,,这样就可以专门放配置文件了
- 获取WINDOWS特殊文件夹
const// registry entries for special paths are kept in : REGSTR_PATH_SPECIAL_FOLDERS = REGSTR_PAT ...
- java 弹出选择目录框(选择文件夹),获取选择的文件夹路径
java 弹出选择目录框(选择文件夹),获取选择的文件夹路径 java 弹出选择目录框(选择文件夹),获取选择的文件夹路径:int result = 0;File file = null;String ...
- 怎样用vb设置文件夹权限?解决办法
原文链接: http://www.reader8.cn/jiaocheng/20120201/1805958.html 怎样用vb设置文件夹权限?现在做的程序需要对win2000和win2003的文件 ...
- windows设置文件夹显示缩略图
windows设置文件夹显示缩略图 CreateTime--2017年7月26日16:32:59Author:Marydon 为什么要显示缩略图? a.显示缩略图后,图片文件能够直接显示内容,不能 ...
- linux系统常用命令 -设置文件夹读写权限
设置文件夹的读写权限: sudo chmod -R 777 /data 权限码描述 sudo chmod 600 ××× (只有所有者有读和写的权限)sudo chmod 644 ××× (所有者有读 ...
随机推荐
- 删除mysql服务
当我们卸载完MySQL后重新装MySQL提示 The service already exists! 是因为服务名称还残留在系统里 打开cmd 输入下面 sc delete mysql 这个mysql ...
- validatebox实现多重规则验证
作为Easyui的校验插件没有实现多重校验能力是一种缺憾.比如说,既要限制格式为email,同时要求最长长度为20,我们就要扩展一种规则,而对长度的要求很容易变化,如果变成要求30,我们又得扩张一种规 ...
- Codeforces 439D Devu and his Brother 三分
题目链接:点击打开链接 = - =曾经的三分姿势不对竟然没有被卡掉,,,太逗.. #include<iostream> #include<string> #include< ...
- IC芯片
5.8寸显示屏/LB058WQ1(SD)01LG2 74HC04 0.3NXP10K 74HC138 0.37NXP20K 74HC245 0.52NXP30K 74HC595 明威 ...
- binutil 工具-----C分析工工具
binutils-- a tools set * ld - the GNU linker. * as - the GNU assembler. * addr2line - Converts addre ...
- redhat 5.0 python2.4升级到2.7
)安装devtoolset yum groupinstall "Development tools" )安装编译Python需要的包包 yum install zlib-devel ...
- shell 实例脚本
例1: #!/bin/bashsum=0;for i in {1..100..2}do let "sum+=i"doneecho "the sum is $sum&quo ...
- apache solr简单搭建
首先,下载位置是:http://lucene.apache.org/solr/downloads.html 官网的学习资料:http://lucene.apache.org/solr/quicksta ...
- 8.LNMP环境的配置
LNMP环境的配置 参照文档:https://oneinstack.com/install/ 安装文件位置:/data/soft: ```yum -y install wget screen pyth ...
- PHP + ajax 实现异步登录验证
login.html: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http:/ ...