Problem with DIRECTORY()

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
User avatar
AUGE_OHR
Posts: 2093
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Problem with DIRECTORY()

Post 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:
have fun
Jimmy
User avatar
serge_girard
Posts: 3308
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: Problem with DIRECTORY()

Post by serge_girard »

Hi Jimmy,

I have same problem! My solution :

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

Serge
There's nothing you can do that can't be done...
User avatar
danielmaximiliano
Posts: 2625
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Contact:

Re: Problem with DIRECTORY()

Post 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 382 times
no asi el direccorio raiz
root dir.png
root dir.png (25.29 KiB) Viewed 382 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 382 times
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
Post Reply