例如我想搜索文件夹userinfo并获取此文件夹下所有的子文件夹名,我要的是文件夹名,不是文件名。请给出示例源码。
解决方案 »
- 如何使用delphi实现两台机器之间的连接,然后实现指定目录文件的拷贝呢
- 简单问题,控制窗口最大化的代码是?
- 新手请教:请问哪里能找到ODBC for Oracle 的驱动
- 求救!datetimepicker的问题!!!
- fastreport 4 问题(50分)
- 请问怎样用Truncate清空paradox表
- 在delphi 中如何 改变excel工作薄的标题?
- 想入门,请问现在用什么开发工具啊
- fastreport 报表中如何知道哪些页已经打印哪些页没有打印?
- 急急!大虾请进! 关于串口通讯 接受数据....
- 子窗口修改父窗口
- (你也来说说吧) 如何减小Delphi 2010 编写应用程序体积.
ShowMessage(DirectoryListBox1.Items.Text);
extractfilepath:获取文件路径
extractfileext:获取扩展名假若有一个'pro.txt'文件
用opendialog打开
就写
if opendialog1.execute then
filename := extractfilename(opendialog1.filename);
获得文件名
外加:extractfilepath--获取文件路径;如:path := extracfilepath(parameter(0)) +filename 这样就得到了整个文件路径
ExtractFileExt--获取扩展名;如:name := ExtractFileExt(filename);再自定義一個變量,將文件名存到變量中,再上傳到數據庫中
SearchRec:TSearchRec;
................. FindFirst(SearchPath+'userinfo\*.*',faAnyFile,SearchRec);
while (FindNext(SearchRec)=0) do
begin
if (SearchRec.Name<>'') and (SearchRec.Attr=faDirectory) then
begin
showmessage(SearchPath+SearchRec.Name);
end;
end;
FindClose(SearchRec);