Delphi获取目录下所有文件名
//ListBox1.Items:= searchfile('Z:\');
//注意,path后面要有'\';
function Searchfile(path:string):TStringList;
var
SearchRec:TSearchRec;
found:integer;
begin
Result:=TStringList.Create;
found:=FindFirst(path+'*.*',faAnyFile,SearchRec);
while found=0 do
begin
if (SearchRec.Name<>'.') and(SearchRec.Name<>'..') and (SearchRec.Attr<>faDirectory) then
Result.Add(SearchRec.Name);
found:=FindNext(SearchRec);
end;
FindClose(SearchRec);
end;
//搜索1个文件下面的文件
// GetDirFiles (ListView1,'Z:\aa\2013-06-23\');
procedure GetDirFiles(ListView:TListView;path: string;fileter:string='*.*');
var
SearchRec: TSearchRec;
found: integer;
begin
ListView.Items.Clear;
found := FindFirst(path + fileter, faAnyFile, SearchRec);
while found = 0 do
begin
if (SearchRec.Name <> '.') and (SearchRec.Name <> '..') and (SearchRec.Attr <> faDirectory) then
ListView.Items.Add.Caption:=SearchRec.Name;
found := FindNext(SearchRec);
end;
FindClose(SearchRec);
end;
上面一个只获取当前目录下所有文件,如果要获取该目录下的子目录的文件,看下面
Delphi获取目录下所有文件名的更多相关文章
- python 遍历, 获取目录下所有文件名和文件夹的方法-----os.walk(), os.listdir
http://www.runoob.com/python/os-walk.html https://www.cnblogs.com/dreamer-fish/p/3820625.html 转载于:ht ...
- python获取指定目录下所有文件名os.walk和os.listdir
python获取指定目录下所有文件名os.walk和os.listdir 觉得有用的话,欢迎一起讨论相互学习~Follow Me os.walk 返回指定路径下所有文件和子文件夹中所有文件列表 其中文 ...
- Python获取路径下所有文件名
python 获取当前文件夹下所有文件名 os 模块下有两个函数: os.walk() os.listdir() 1 # -*- coding: utf-8 -*- 2 3 import os 4 ...
- C# 获取目录下文件
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; usin ...
- Java 读取指定目录下的文件名和目录名
需求:读取指定目录下的文件名和目录名 实现如下: package com.test.common.util; import java.io.File; public class ReadFile { ...
- 取CPU序列号,获取网卡,取硬盘系列号,获取目录下的文件,强制删除目录
unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms ...
- python生成器 获取 目录下文件
# os.walk()和os.list 都是得到所有文件的列表, 如果目录下文件特别多, 上亿了, 我们就需要生成器的方式获取 # 要求目录下面没有目录, 会递归到子目录下面找文件, (如果有子目录可 ...
- Python开发【笔记】:获取目录下所有文件
获取文件 import os def sub_dirs(rdir): li = os.listdir(rdir) return li def main(rdir): content = sub_dir ...
- Python--通过索引excel表将文件进行文件夹分类的脚本+读取指定目录下所有文件名的脚本
1.通过索引excel表将文件进行文件夹分类的脚本,此脚本由于将ip和id对应并生成对应id的文件夹将文件进行分类,也可以任意规定表格内容,通过vul_sc_ip.txt和xlsx文件进行索引. # ...
随机推荐
- php类的实现
zend_class_entry typedef struct _zend_class_entry zend_class_entry; struct _zend_class_entry { char ...
- Fiddler的基本介绍
fiddler 简介: 一款免费且功能强大的数据包抓取软件.它通过代理的方式获取程序http通讯的数据,可以用其检测网页和服务器的交互情况,能够记录所有客户端和服务器间的http请求,支持监视.设置断 ...
- ♫【jQuery插件】图片放大镜
JQZoom
- 【转】Parallels Desktop 11.2.0 破解版 最佳Mac虚拟机软件
原文网址:http://www.macappstore.net/parallels-desktop-11-pojie-ban/ Parallels Desktop 11.2.0 破解版 最佳Mac虚拟 ...
- 【转】Windows环境下Android NDK环境搭建
原文网址:http://www.metsky.com/archives/525.html 前面介绍Windows下Android 开发环境配置,主要是面向JAVA开发环境,对只做APK上层应用开发人员 ...
- table中tr使用toggle不好,选择换一张方式
好几次遇到的问题,都是table中tr后面有一部分内容要显示,也是用tr装的,但是需要点击该行,后面那个tr才显示出来.不过最好不要用toggle去写,因为着实效果不佳.故而建议换一种方式,也许最简单 ...
- HDU 4394 Digital Square
Digital Square Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)To ...
- [Bhatia.Matrix Analysis.Solutions to Exercises and Problems]ExI.5.10
Every $k\times k$ positive matrix $A=(a_{ij})$ can be realised as a Gram matrix, i.e., vectors $x_j$ ...
- Codeforces 611D New Year and Ancient Prophecy dp+字符串比较
这是CF Goodbye 2015 的D题,当时我想了一个n^3的dp算法,肯定不能过,然后听到学长后缀数组的n^2log(n)写法,仰慕 最后打完比赛看到了t神的n^2写法,简直膜拜,直接省去了后缀 ...
- sql-逻辑循环while if
--计算1-100的和 declare @int int=1; declare @total int=0; while(@int<=100) begin set @total=@total+@i ...