我已经看了,但是我的想法是选中某个目录后,直接上传这个目录下的所有文件和文件夹,这里就要用到本地文件夹的遍历了吧,我在网上找了一些遍历的代码,但总有问题,遍历出来的结果总是会有重复,不知是为什么....<br><br>我找到的代码如下:<br><br><br>//================================================================<br>//遍历某个文件夹及子文件夹下某种文件,<br>//使用说明<br>// ??_GetFileList(ListBox1.Items,'c:/','*.doc');<br>// _GetFileList(MyTStringList,'c:/','*.exe');<br>//================================================================<br>procedure_GetFileList(AStrings:TStrings;ASourFile,<br> FileName:string);<br>varsour_path,sour_file:string;<br> TmpList:TStringList;<br> FileRec,subFileRec:TSearchrec;<br> i:Integer;<br>begin<br> ifrightStr(trim(ASourFile),1)<>'/'then<br> sour_path:=trim(ASourFile)+'/'<br> else<br> sour_path:=trim(ASourFile);<br> sour_file:=FileName;<br><br> ifnotDirectoryExists(sour_path)then<br> begin<br> AStrings.Clear;<br> exit;<br> end;<br><br> TmpList:=TStringList.Create;<br> TmpList.Clear;<br><br> ifFindFirst(sour_path+'*.*',faAnyfile,FileRec)=0then<br> repeat<br> if((FileRec.AttrandfaDirectory)<>0)then<br> begin<br> if((FileRec.Name<>'.')and(FileRec.Name <>'..'))then<br> _GetFileList(AStrings,sour_path+FileRec.Name+'/', sour_file);<br> end<br> else<br> ifFindFirst(sour_path+FileName,faAnyfile,subFileRec)=0then<br> repeat<br> if((subFileRec.AttrandfaDirectory)=0)then<br> TmpList.Add(sour_path+subFileRec.Name);<br> untilFindNext(subFileRec)<>0;<br><br> untilFindNext(FileRec)<>0;<br><br> SysUtils.FindClose(FileRec);<br> fori:=0toTmpList.Count-1do<br> AStrings.Add(TmpList.Strings);<br><br> TmpList.Free;<br>end;