Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Use Of ADIR()
Message
From
13/06/2008 18:52:25
 
 
To
12/06/2008 02:46:50
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01323376
Message ID:
01324023
Views:
24
Thank you Tore, both yours and Sergey's works fine!!!
Ma

>
>**DO getfilelist WITH 'c:\*.*','DHS'
>
>Procedure Getfilelist
>   Lparameters lcFileSkeleton,lcAttributes,llKeepDirectory
>   Do RecurseDirectories With lcFileSkeleton,lcAttributes,llKeepDirectory
>   Wait Clear
>   If Used('filedirectory')
>      Index On filepath Tag filepath
>      Index On filename Tag filename
>      Index On filesize Tag filesize
>   Endif
>   Set Order To filepath && FILEPATH
>   Go Top
>   Browse Nowait
>Return
>
>****************************************
>Procedure RecurseDirectories
>   Lparameters lcFileSkeleton,lcAttributes,llKeepDirectory
>   Local Array laDirectory[1,1]
>   Local lnFileCount As Integer
>   Local lnCounter As Integer
>   Local lcCurrentPath As Varchar(200)
>   If Empty(llKeepDirectory)
>      llKeepDirectory = .F.
>   Endif
>   If (!llKeepDirectory) And File('FileDirectory.dbf')
>      Use In Select('filedirectory')
>      Delete File filedirectory.Dbf
>   Endif
>   If !llKeepDirectory
>      Create Table filedirectory (filepath Varchar(200),filename Varchar(100), filesize Integer, ModiDate Date, ModiTime Char(16), FileAttr Char(6))
>   Endif
>   If Empty(lcFileSkeleton)
>      lcFileSkeleton = '*.*'
>   Endif
>   If Empty(lcAttributes)
>      lcAttributes = 'DHS'
>   Endif
>   lnFileCount = Adir(laDirectory,lcFileSkeleton,lcAttributes)
>   lcCurrentPath = Justpath(lcFileSkeleton)
>   Wait 'Processing: '+Alltrim(lcCurrentPath)+'..hang on!' Window Nowait
>   If lnFileCount > 0
>      For lnCounter = 1 To lnFileCount
>         If !Empty(Strtran(laDirectory[lncounter,1],'.',''))
>            If 'D' $ laDirectory[lncounter,5] && directory - need to recursively call!
>               RecurseDirectories(Addbs(lcCurrentPath)+Addbs(Trim(laDirectory[lncounter,1]))+Justfname(lcFileSkeleton),lcAttributes,.T.)
>            Else
>               Insert Into filedirectory (filepath,filename,filesize,ModiDate,ModiTime,FileAttr) Values (lcCurrentPath,laDirectory[lncounter,1],laDirectory[lncounter,2],laDirectory[lncounter,3],laDirectory[lncounter,4],laDirectory[lncounter,5])
>            Endif
>         Endif
>      Endfor
>   Endif && lnFileCount > 0
>   Return && recursedirectories
>Return && getfilelist
>
>
>>Hi:
>>
>>I've never used ADIR() nor arrays. I'm trying to get files names from a network directory (mapped as Z:\) into a VFP cursor. This is what I've tried so far:
>>
>>SET PATH TO Z:\
>>filecount = ADIR(existingfiles,'*.MPG')
>>
>>? filecount will display 24110
>>DISPLAY MEMEORY existingfiles will displays all of the file information.
>>
>>Now, I'd like to get this information from array 'existingfiles' into a VFP cursor by doing the following:
>>
>>CREATE CURSOR filedata FROM ARRAY existingfiles
>>
>>This produces a "Array dimensions are invalid" error message.
>>
>>What am I missing.
>>
>>TIA
Previous
Reply
Map
View

Click here to load this message in the networking platform