有两个结构相同的对应目录(子目录个数相同,对应目录名相同),都是:两层,一个父目录下面多个子目录,子目录下只有文件要做的就是:把那些对应文件作比较,同名的删除。请问高手们如何解决?
可以用delphi自己的api:routine做吗?
可以用delphi自己的api:routine做吗?
解决方案 »
- XML父节点增加属性,为什么子节点也会自动添加相同的属性?
- delphi listview选中问题
- delphi线程里动态生成mscomm,线程不起作用
- 关于对一个EXCEL文件内容匹配的实现问题,问哈思路..高手请指教!
- 递归调用方面的
- 用哪个控件可以将WORD编辑环境镶嵌到我的主窗体上去?
- 散分交友第三贴:所谓无耐,就是必须要在Begin后加一个End!
- 想作一个命令按钮,从TPanel继承来的,不能响应cm_enablechanged事件。。。
- 关于TCHART控件 多个series 里哪条曲线可看到与看不到的方法,简单,马上给分
- 诸位高人,帮我看看我的毕设题目好吗?我怎么觉得一头雾水!
- FindComponent函数不能用于Label控件吗?
- 请教有关dll问题
第一层循环遍历目录,第二层遍历子目录中的所有文件。。?
sr: TSearchRec;
FileAttrs: Integer;
begin
StringGrid1.RowCount := 1;
if CheckBox1.Checked then
FileAttrs := faReadOnly
else
FileAttrs := 0;
if CheckBox2.Checked then
FileAttrs := FileAttrs + faHidden;
if CheckBox3.Checked then
FileAttrs := FileAttrs + faSysFile;
if CheckBox4.Checked then
FileAttrs := FileAttrs + faVolumeID;
if CheckBox5.Checked then FileAttrs := FileAttrs + faDirectory;
if CheckBox6.Checked then
FileAttrs := FileAttrs + faArchive;
if CheckBox7.Checked then FileAttrs := FileAttrs + faAnyFile; with StringGrid1 do
begin
RowCount := 0; if FindFirst(Edit1.Text, FileAttrs, sr) = 0 then begin
repeat
if (sr.Attr and FileAttrs) = sr.Attr then
begin
RowCount := RowCount + 1;
Cells[1,RowCount-1] := sr.Name;
Cells[2,RowCount-1] := IntToStr(sr.Size);
end;
until FindNext(sr) <> 0;
FindClose(sr);
end;
end;
end;
本问题关键一个在于一开始没看到faDirectory这个常量,一个在于FindFirst的说明也没仔细看,里面有说如果第一个参数是xxxx路径\*.* ,则可遍历所有
Anyway谢谢大家帮助,启迪我btw还有那位有其它方法解决该问题??请示之,thx!!!