Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Reading directories recursively
Message
 
To
25/07/2002 07:32:33
John Faithfull
Hunterian Museum, University of Glasgow,
Glasgow, United Kingdom
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00680366
Message ID:
00682496
Views:
18
John:

Here is a simple 100% VFP solution I wrote for doing this a couple of years ago...it stores all directory info in a table and uses recursion... It can catalog your whole drive VERy quickly. The report it runs is just a VFP report to list out the table...

Harold Chattaway
hchattaway@webconnectiontraining.com


*---- RECURSIVE DIR UTILITY...
*---- Harold Chattaway
**********************************
parameter llrecurse

set safety off

LNPATH = GETDIR()

CREATE TABLE LNPATH+"FILELIST" (NAME C(20), SIZE i, LASTMOD D, TIMEMOD C(10), ATTR C(5), PATH C(150))
INDEX ON PATH+NAME TAG PRIMARY

=loaddir(LNPATH)

IF MESSAGEBOX("Run Report?",20,"Run Report") = 6
REPORT FORM filelist TO PRINT PREVIEW
ENDIF
USE IN filelist

*************************************
FUNCTION loaddir
*************************************
LPARAMETER lcdir
LOCAL lnfiles, x
LOCAL ARRAY DIRLIST[1,5]
lnfiles=ADIR(DIRLIST,lcdir+"*.*","D")

FOR x = 1 TO lnfiles

*--- DO NOT STORE "." AND ".." DIRECTORIES...
IF !INLIST(upper(DIRLIST[X,1]),".") and AT(".D",DIRLIST[x,5]) = 0
INSERT INTO filelist (NAME, SIZE, LASTMOD, TIMEMOD, ATTR, PATH) ;
VALUES (DIRLIST[X,1], DIRLIST[X,2], DIRLIST[X,3],DIRLIST[X,4], DIRLIST[X,5], lcdir)
ENDIF

*--- RECURSIVELY CALL ITSELF!
IF llrecurse and AT(".D",DIRLIST[x,5]) > 0 AND !INLIST(upper(DIRLIST[X,1]),".","_VTI")
=loaddir(lcdir+DIRLIST[x,1]+"\")
ENDIF

ENDFOR

RETURN







>Hello George,
>
>Sorry for not replying sooner, but your method 2
>
>oFSO = CREATEOBJECT("Scripting.FileSystemObject")
>* Copy with overwrite. No progress bar
>oFSO.CopyFolder("C:\MyFolder", "D:\MyFolder", .T.)
>
>is exactly what I needed, and works great on our Win2k machines.
>
>This may be a dumb question, but
>will this work on Win9x machines as well?
>
>I don't have one handy to run a test on.
>
>Thanks again
>
>John
Previous
Reply
Map
View

Click here to load this message in the networking platform