请问如何使用IDFTP上传文件夹及其子文件夹内所有文件?或者会文件夹遍历的也行[简单的问题](200分)

  • 主题发起人 主题发起人 xinux11
  • 开始时间 开始时间
X

xinux11

Unregistered / Unconfirmed
GUEST, unregistred user!
请问如何使用IDFTP上传文件夹及其子文件夹内所有文件?<br><br>或者有文件夹及子件夹内文件遍历的代码也可以的,谢谢大家了!<br><br>有代码最好,给思路也行。
 
给你个例子,邮箱?
 
xinux@yeagen.com<br>pengweiqing10@163.com
 
我已经看了,但是我的想法是选中某个目录后,直接上传这个目录下的所有文件和文件夹,这里就要用到本地文件夹的遍历了吧,我在网上找了一些遍历的代码,但总有问题,遍历出来的结果总是会有重复,不知是为什么....<br><br>我找到的代码如下:<br><br><br>//================================================================<br>//遍历某个文件夹及子文件夹下某种文件,<br>//使用说明<br>// &nbsp; &nbsp; ??_GetFileList(ListBox1.Items,'c:/','*.doc');<br>// &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;_GetFileList(MyTStringList,'c:/','*.exe');<br>//================================================================<br>procedure_GetFileList(AStrings:TStrings;ASourFile,<br> FileName:string);<br>varsour_path,sour_file:string;<br> &nbsp; TmpList:TStringList;<br> &nbsp; FileRec,subFileRec:TSearchrec;<br> &nbsp; i:Integer;<br>begin<br> &nbsp;ifrightStr(trim(ASourFile),1)&lt;&gt;'/'then<br> &nbsp; &nbsp;sour_path:=trim(ASourFile)+'/'<br> &nbsp;else<br> &nbsp; &nbsp;sour_path:=trim(ASourFile);<br> &nbsp;sour_file:=FileName;<br><br> &nbsp;ifnotDirectoryExists(sour_path)then<br> &nbsp;begin<br> &nbsp; &nbsp;AStrings.Clear;<br> &nbsp; &nbsp;exit;<br> &nbsp;end;<br><br> &nbsp;TmpList:=TStringList.Create;<br> &nbsp;TmpList.Clear;<br><br> &nbsp;ifFindFirst(sour_path+'*.*',faAnyfile,FileRec)=0then<br> &nbsp;repeat<br> &nbsp; &nbsp; if((FileRec.AttrandfaDirectory)&lt;&gt;0)then<br> &nbsp; &nbsp; &nbsp; &nbsp;begin<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if((FileRec.Name&lt;&gt;'.')and(FileRec.Name &lt;&gt;'..'))then<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;_GetFileList(AStrings,sour_path+FileRec.Name+'/', sour_file);<br> &nbsp; &nbsp; &nbsp; &nbsp;end<br> &nbsp; &nbsp; else<br> &nbsp; &nbsp; &nbsp; ifFindFirst(sour_path+FileName,faAnyfile,subFileRec)=0then<br> &nbsp; &nbsp; &nbsp; repeat<br> &nbsp; &nbsp; &nbsp; &nbsp; if((subFileRec.AttrandfaDirectory)=0)then<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; TmpList.Add(sour_path+subFileRec.Name);<br> &nbsp; &nbsp; &nbsp; untilFindNext(subFileRec)&lt;&gt;0;<br><br> &nbsp;untilFindNext(FileRec)&lt;&gt;0;<br><br> &nbsp;SysUtils.FindClose(FileRec);<br> &nbsp;fori:=0toTmpList.Count-1do<br> &nbsp; &nbsp;AStrings.Add(TmpList.Strings);<br><br> &nbsp;TmpList.Free;<br>end;
 
使用递归搜索子目录<br>http://www.eston.com.cn/BBS/topic.asp?topic_id=723
 
后退
顶部