Page 1 of 1

Problem with DIRECTORY()

Posted: Wed Aug 11, 2021 11:57 pm
by AUGE_OHR
hi,

i found a strange Problem with DIRECTORY()
i do search for "862*" but Result include 2 Records :o

Code: Select all

#include "Fileio.ch"
PROCEDURE MAIN()
LOCAL aFiles := {}, i
LOCAL nHandle

   AADD(aFiles,"86020200630.JPG")
   AADD(aFiles,"86120200630.JPG")
   AADD(aFiles,"86220200630.JPG")
   AADD(aFiles,"86320200630.JPG")
   AADD(aFiles,"86420200630.JPG")
   AADD(aFiles,"86520200630.JPG")
   AADD(aFiles,"86720200630.JPG")
   AADD(aFiles,"86720200819.JPG")
   AADD(aFiles,"86720201023.JPG")
   AADD(aFiles,"86720210114.JPG")
   AADD(aFiles,"86720210702.JPG")
   AADD(aFiles,"86820200630.JPG")
   AADD(aFiles,"86920200630.JPG")

   FOR i := 1 TO LEN(aFiles)
      nHandle := FCreate( aFiles[i], FC_NORMAL )
      FWrite( nHandle, "Jimmy" )
      FClose( nHandle )
   NEXT

   aDir := DIRECTORY("862*.JPG")
   Msgbox ( VAR2CHAR(aDir) )
RETURN

#IFDEF __XPP__
#ELSE

FUNCTION MsgBox(x)
RETURN MsgInfo(x)

FUNCTION VAR2CHAR( cIn )
LOCAL cOut := hb_valToExp( cIn )
   RETURN STRTRAN( cOut, '"', '' )
#ENDIF
it also happens in Xbase++ so it is a "General" Problem ... but "What" :idea:

Re: Problem with DIRECTORY()

Posted: Thu Aug 12, 2021 9:37 am
by serge_girard
Hi Jimmy,

I have same problem! My solution :

aDir := DIRECTORY("*.JPG")
then SCANDIR or FOR .. IF.. NEXT

Serge

Re: Problem with DIRECTORY()

Posted: Thu Aug 12, 2021 12:32 pm
by danielmaximiliano
Hola Jimmy y Gerard se debe a que la estructura de directorios contienen .. y .
harbour dir.png
harbour dir.png (29.31 KiB) Viewed 445 times
no asi el direccorio raiz
root dir.png
root dir.png (25.29 KiB) Viewed 445 times
esta en la estrucura
2021-08-12 09_26_28-Window.png
2021-08-12 09_26_28-Window.png (20.11 KiB) Viewed 445 times