Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Adir()
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Re: Adir()
Miscellaneous
Thread ID:
00490460
Message ID:
00490478
Views:
7
Create a function that receive a path as parameter.

The first in the function get all folders in the received path. Loop through one at the time and call the function again with the new path (oldparg+folder name in loop).

After the folders find all files in the path and do your stuff.

Fast not tested code example:
FUNCTION findFiles
LPARAMETERS pcPath

  LOCAL laFld(1), laFiles(1), lnFld, lnFiles

  lnFld = ADIR(laFld, pcPath, "D")

  DO WHILE lnFld > 0
    *!* Ignore current and previous folder  (".", "..")
    IF "." # laFld(lnFld, 1) .AND. ".." # laFld(lnFld, 1) THEN
      findFiles(ADDBS(pcPath)+laFld(lnFld, 1))
    ENDIF

    lnFld = lnFld - 1
  ENDDO

  lnFiles = ADIR(laFiles, ADDBS(pcPath)+"*.*")

  *!* Do your stuff here.. Like put the file names in a cursor, etc.
ENDFUNC

>HI people(fox people)!!!
>I have to create a program that will receave the parameter(directory) in which it will check for files that have same filenames. And than put the names of this files into textfile. Well i'm using adir() command, but the problem is that it looks for the files in directory and its subdirs., but doesn't check the subdirs of subdirs...
> What do i have to do?
>Thank U.


HTH,
- Erik Niese-Petersen

Crazy Dane in USA.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform