> > > Hello.
> > > Please show me how to list all files and directories on a drive (or the other directory) by useing VFP or Win32API.
> > > thanks!
> >
> > Hi there,
> >
> > see the function ADIR(). The help explains how to use it.
> >
> > Regards
> >
> > Gaetan
> Hi,
> Thank you for your suggestion
hi,
i got the code recently from a tip in VFP Advisor magazine. i can't remember the name of the person who submitted the tip. anyway, i modified the code to suit my needs. check out the code below.
Clear All
lcFolderPath = GetDir('','Select Folder','',64,.f.)
If Empty(lcFolderPath)
lcFolderPath = FullPath(Curdir())
EndIf
lcCurrPath = Fullpath(Curdir())
Cd (lcFolderPath)
lcFile = Recursion()
Cd (lcCurrPath)
lcMess = 'Files lookup completed.' + Chr(13) +;
'List of files is located at : ' + Chr(13) + lcFile
Messagebox(lcMess,64,lcFolderPath)
Procedure Recursion
If !Used('curFiles')
Create Cursor curFiles (cFname c(200))
Endif
Local lnCount, laDirs[1], lcFile, i
lcFile = Addbs(Sys(2023)) + 'Files.txt'
lcPath = Addbs(Fullpath(Curdir()))
lnCount = Adir(laDirs,"*.*","D")
For i = 1 To lnCount
If (laDirs[i,1] <> ".") And ("D" $ laDirs[i,5])
Cd Alltrim(laDirs[i,1])
lnCnt = Adir(laFiles,'*.*','')
For lnX = 1 To lnCnt
If !("D" $ laFiles[lnX,5])
m.cFname = Addbs(Fullpath(Curdir())) +;
laFiles[lnX,1]
Wait Window 'Reading : ' + m.cFname;
nowait
Insert Into curFiles From Memvar
Endif
Next
Do Recursion
Cd ..
Endif
Next
Select curFiles
Copy To (lcFile) Type Sdf
Return lcFile
Endproc
to the guy who wrote the recursion procedure thanks, it was really a great help... sorry i can't remember your name. once again thanks... you know who your are and i hope you don't mind that i modified your code.
hope this helps,
Erik Gomez
www.foxite.com - The Home of The Visual FoxPro Experts
Long Live
www.foxite.com