Clear All Clear Public oForm oForm=Createobject("MyForm",Addbs(Getdir("c:\program files")),"*.exe",.F.) Define Class MyForm As Form AllowOutput=.F. && so '?' output goes to screen Width=_Screen.Width Height=_Screen.Height-50 Width=1024 Height=798 Procedure Init(cPath As String, cMask As String, fSubDir As Boolean) Set Exclusive Off Set Safety Off Set Talk Off Set Exact Off Create Table Files (Path c(240),fname c(240),Fsize N(10,0),Timestamp T) This.DoDir(cPath,cMask) Index On Timestamp Descending Tag T && choose your desired order * INDEX on fsize DESCENDING TAG fsize This.AddObject("gr","grid") This.gr.AllowCellSelection=.F. This.gr.Visible=1 This.gr.Height=Thisform.Height This.gr.Width = Thisform.Width This.gr.AutoFit This.gr.Column3.InputMask="999,999,999" This.Show Procedure DoDir(cPath As String, cMask As String) Local N,i,aa[1] N=Adir(aa,cPath+cMask,"",1) For i = 1 To N Insert Into Files (Path,fname,Fsize,Timestamp) Values ; (cPath, aa[i,1], aa[i,2],Ctot(Dtoc(aa[i,3])+aa[i,4])) Endfor N=Adir(aa,cPath+"*.*","HD",1) && now without the mask, search for directories For i = 1 To N If "D"$aa[i,5] && if it's a dir If aa[i,1] != '.' This.DoDir(cPath+aa[i,1]+"\",cMask) && recur Endif Endif Endfor EnddefineI also have this program to create a cursor of a directory
Lparameters pcSkeleton, pcCursorname, plMoreinfo Local lcFilename, llNeste, lcPath, lnLen If Pcount()<1 Or Vartype(pcSkeleton)#'C' Or (Pcount()>1 And Vartype(pcCursorname)#'C') Return -1 Else If Pcount()=1 pcCursorname='curDumyDir' Endif llNeste=.F. Create Cursor (pcCursorname) (filnavn c(1)) Do While .t. If llNeste lcFilename=Sys(2000,pcSkeleton,1) Else lcFilename=Sys(2000,pcSkeleton) Endif If Len(lcFilename)>len(filnavn) lnLen=Len(lcFilename) Alter Table (pcCursorname) alter Column filnavn c(lnLen) Endif If !Empty(lcFilename) Insert Into (pcCursorname) (filnavn) Values (Juststem(lcFilename)) Else Exit Endif llNeste=.T. Enddo Endif If Reccount()>0 And plMoreinfo Alter Table (pcCursorname) Add column dato d Alter Table (pcCursorname) Add column fsize i Alter Table (pcCursorname) Add column fulltnavn c(lnLen) Scan Adir(aDummy,(Addbs(justpath(pcSkeleton)) + Trim(filnavn) + '.' + Justext(pcSkeleton))) replace dato With aDummy(3), fsize With aDummy(2), fulltnavn With aDummy(1) Endscan Endif Return Reccount()