i try to find all File with Attribut "A"
Code: Select all
LOCAL aFFList := HB_DirScanM( "c:\hmg.3.4.4\", {"*.*"}, "A" )
msgInfo (STR(LEN(aFFlist)) + " Files" )
Question : how to modify Code to get only "new files" with Attribut "A"

Moderator: Rathinagiri
Code: Select all
LOCAL aFFList := HB_DirScanM( "c:\hmg.3.4.4\", {"*.*"}, "A" )
msgInfo (STR(LEN(aFFlist)) + " Files" )
Normally, the Directory() function get files w/o any attrib and/or "Read only" and/or "Archive" + given special HSDV attributes: https://harbour.github.io/doc/clc53.html#directoryAUGE_OHR wrote: ↑Mon Mar 16, 2020 8:13 am hi,
i try to find all File with Attribut "A"but it give me all filesCode: Select all
LOCAL aFFList := HB_DirScanM( "c:\hmg.3.4.4\", {"*.*"}, "A" ) msgInfo (STR(LEN(aFFlist)) + " Files" )
Question : how to modify Code to get only "new files" with Attribut "A"![]()
Code: Select all
#include "hmg.ch"
Function Main()
LOCAL aFFList := HB_DirScanM( "g:\, "*.prg", "a" )
msgdebug (aFFlist)
RETURN
#include "directry.ch"
#include "fileio.ch"
STATIC FUNCTION hb_doScanM( cPath, aMask, cAttr, cPathSep )
LOCAL aFile
LOCAL lMatch
LOCAL aResult := {}
FOR EACH aFile IN hb_vfDirectory( cPath + hb_osFileMask(), cAttr + "D" )
lMatch := .F.
AEVAL( aMask, { | x | iif( HB_ISSTRING ( x ), lMatch := hb_FileMatch( aFile[ F_NAME ], x ) .OR. lMatch, Nil) } )
IF "D" $ aFile[ F_ATTR ]
IF lMatch .AND. "D" $ cAttr
AAdd( aResult, aFile )
ENDIF
IF !( aFile[ F_NAME ] == "." .OR. aFile[ F_NAME ] == ".." .OR. aFile[ F_NAME ] == "" )
AEval( hb_DoScanM( cPath + aFile[ F_NAME ] + cPathSep, aMask, cAttr, cPathSep ), ;
{| x | x[ F_NAME ] := aFile[ F_NAME ] + cPathSep + x[ F_NAME ], ;
AAdd( aResult, x ) } )
ENDIF
ELSEIF lMatch .AND. MatchAttr( cAttr, aFile [ F_ATTR ] )
AAdd( aResult, aFile )
ENDIF
NEXT
RETURN aResult
FUNCTION MatchAttr( cAttr, fAttr )
LOCAL i, lRet:=.F.
IF Empty (cAttr)
RETURN .T.
ENDIF
FOR i=1 TO Len( cAttr )
lRet:= lRet .OR. Upper( Substr ( cAttr , i, 1 ) )$Upper( fAttr )
NEXT i
RETURN lRet
FUNCTION hb_DirScanM( cPath, aFileMask, cAttr )
RETURN hb_DoScanM( hb_DirSepAdd( hb_defaultValue( cPath, "" ) ), ;
iif( HB_ISARRAY( aFileMask ), aFileMask, iif (HB_ISSTRING( aFileMask ), { aFileMask }, { hb_osFileMask() } ) ), ;
hb_defaultValue( cAttr, "" ), ;
hb_ps() )
Code: Select all
ELSEIF lMatch .AND. MatchAttr( cAttr, aFile [ F_ATTR ] )
Code: Select all
ELSEIF lMatch .AND. MatchAttr( cAttr, aFile [ F_ATTR ] ) .AND. aFile [ F_SIZE ] > 0