Page Date
2004-05-18
DD-Software
Kapitel zurück / previous Chapter
Main Index
 
Seite zurück / previous page
Backward
Seite vor / next page
Forward
 
Seitenanfang/TopOfPage
Top
Seitenende/EndOfPage
Bottom
MyWbtHelp current version

WinBatch Scripting - Miscellaneous - NetWare



Seitenanfang/TopOfPage Seitenende/EndOfPage
Seitenanfang/TopOfPage Seitenende/EndOfPage

Build a report regarding n days old files on NetWare server (using the File Search Extender)

;-------------------------------------------------------------------------------
; Build a report of files on the NetWare server, 
; which were last modified more than x days before now.
; Detlev Dalitz.20010803
;-------------------------------------------------------------------------------
#DefineFunction udfHeaderScale (len, delimiter)
p = 0
n = len
While @true
   n = n/10
   If (n==0) Then Break
   p = p+1
EndWhile
outstr = ""
While (p>0)
   str = ""
   hmax = 1+(len/(10**p))
   filler = StrFill("_",(10**p)-1)
   For h=1 To hmax
      str = StrCat(str,filler,h mod 10)
   Next
   str = StrSub(str,1,len)
   outstr = StrCat(outstr,str,delimiter)
   p = p-1
EndWhile
str = StrFill("1234567890",len)
outstr = StrCat(outstr,str,delimiter)
Return (outstr)
#EndFunction
;-------------------------------------------------------------------------------
#DefineFunction udfAddCommas (numstring)
intpart=ItemExtract(1,numstring, ".")
fractpart=ItemExtract(2,numstring,".")
groups=((StrLen(intpart)-1)/3)+1
answer=""
For y=1 To groups
   If y==1
      ptr=((StrLen(intpart)-1) mod 3)+1
      answer=StrSub(intpart,1,ptr)
      ptr=ptr+1
   Else
      answer=StrCat(answer,",",StrSub(intpart,ptr,3))
      ptr=ptr+3
   EndIf
Next
If (fractpart<>"") Then answer=StrCat(answer,".",fractpart)
Return (answer)
#EndFunction
;-------------------------------------------------------------------------------

;===============================================================================
;--- user configurable area begin ---
mylogfile      = "D:\TEMP\LOG.TXT"
myserver       = "W:\"        ; UNC name allowed  \\SERVER\SHARE\FOLDER\... 
UseDiffDays    = 90           ; How old, last modified before x days. 
UseSafeMode    = 0            ; Activate safer error checking on file access
UseDisplayStep = 25           ; Display search activity on every each x steps.
UseVerboseMode = 0            ; More information about old files
;--- user configurable area end ---
;===============================================================================

; Be aware that file access by Search Extender modifies 
; the Last Accessed timestamp on each file it touches.


AddExtender("wsrch34i.dll")
; AddExtender('WWNWU34I.DLL') ; before 17.07.2002
AddExtender('WWNWX34I.DLL')

IntControl(5,1,0,0,0) ;Allow system and hidden files to be counted

start = TimeYmdHms()
handle = FileOpen(mylogfile,"WRITE")
FileWrite(handle,udfHeaderScale(200,@crlf))
FileWrite(handle,start)
FileWrite(handle,"")
outstr=StrFixLeft("Size KB","",15)
outstr=StrCat(outstr,"  ",StrFix("Owner","",15))
outstr=StrCat(outstr,"  ",StrFix("Last accessed","",15))
outstr=StrCat(outstr,"  ",StrFix("Last accessor","",15))
outstr=StrCat(outstr,"  ",StrFix("Last modified","",21))
If UseSafeMode Then outstr = StrCat(outstr,"  ",StrFixLeft("ErrNr","",5))
outstr=StrCat(outstr,"  ","Filename")
FileWrite(handle,outstr)

BoxOpen(StrCat("Filesearch started ",start,"  days diff.=",UseDiffDays), "Searching")

oldn=""
oldc=0
sum=0
c=0
hand = SrchInit(myserver,"*.*","","",24)
While 1
   fname = SrchNext(hand)
   If (fname=="") Then Break
   If FileExist(fname)
      c=c+1
      If UseSafeMode
         LastErrorMode=ErrorMode(@off)
         IntControl(72,2,0,0,0)
         LastError()
         owner = nwGetFileInfo(fname,2,"","",0)
         ResultCode = LastError()
         ErrorMode(LastErrorMode)
         ; do error handling if necessary

         LastErrorMode=ErrorMode(@off)
         IntControl(72,2,0,0,0)
         LastError()
         lastmodified = nwGetFileInfo(fname,3,"","",0)
         ResultCode = LastError()
         ErrorMode(LastErrorMode)
         ; do error handling if necessary

         LastErrorMode=ErrorMode(@off)
         IntControl(72,2,0,0,0)
         LastError()
         lastaccessor = nwGetFileInfo(fname,4,"","",0)
         ResultCode = LastError()
         ErrorMode(LastErrorMode)
         ; do error handling if necessary

         LastErrorMode=ErrorMode(@off)
         IntControl(72,2,0,0,0)
         LastError()
         lastaccessed = nwGetFileInfo(fname,5,"","",0)
         ResultCode = LastError()
         ErrorMode(LastErrorMode)
         ; do error handling if necessary

      Else
         owner        = nwGetFileInfo(fname,2,"","",0) ; name of the object
         lastmodified = nwGetFileInfo(fname,3,"","",0) ; TimeYmdHms
         lastaccessor = nwGetFileInfo(fname,4,"","",0) ; name of the object
         lastaccessed = nwGetFileInfo(fname,5,"","",0) ; TimeYmdHms
      EndIf

      isold = (TimeDiffDays(start,lastmodified) > UseDiffDays)
   Else
      owner        = "unknown"
      lastmodified = "unknown"
      lastaccessor = "unknown"
      lastaccessed = "unknown"
      isold = @true
   EndIf
   If !(c mod UseDisplayStep)
      dispcount = StrCat(StrFix("Count","",15),@tab,udfAddCommas(c))
      dispname  = StrCat(StrFix("Filename","",15),@tab,fname)
      dispmod   = StrCat(StrFix("Last modified","",15),@tab,lastmodified)
      dispacc   = StrCat(StrFix("Last accessed","",15),@tab,lastaccessed)
      dispacco  = StrCat(StrFix("Last accessor","",15),@tab,lastaccessor)
      dispold   = StrCat(StrFix("File is old","",15),@tab,isold)
      outstr = StrCat(dispcount,@cr,dispname,@cr,dispmod,@cr,dispacc,@cr,dispacco,@cr,dispold)
      If UseVerboseMode
         If isold Then oldn=fname
         dispoldn = StrCat(StrFix("Filename old","",15),@tab,oldn)
         dispown  = StrCat(StrFix("Owner","",15),@tab,owner)
         dispoldc = StrCat(StrFix("Count old","",15),@tab,udfAddCommas(oldc))
         dispsum  = StrCat(StrFix("KB summed old","",15),@tab,udfAddCommas(sum))
         dispperf = StrCat(StrFix("Files/sec","",15),@tab,udfAddCommas(c/(1+TimeDiffSecs(TimeYmdHms(),start))))
         outstr = StrCat(outstr,@cr,@cr,dispoldc,@cr,dispoldn,@cr,dispown,@cr,dispsum,@cr,@cr,dispperf)
      EndIf
      BoxText(outstr)
   EndIf

   If !isold Then Continue

   oldc = oldc + 1
   sizekb = 0
   fsize = FileSizeEx(fname)
   If (fsize>0) Then sizekb = Int(1.0+(fsize/1024))
   sum = sum + sizekb
   outstr = StrFixLeft(udfAddCommas(sizekb),"",15)
   outstr = StrCat(outstr,"  ",StrFix(owner,"",15))
   outstr = StrCat(outstr,"  ",StrFix(StrSub(lastaccessed,1,10),"",15))
   outstr = StrCat(outstr,"  ",StrFix(lastaccessor,"",15))
   outstr = StrCat(outstr,"  ",StrFix(lastmodified,"",21))
   If UseSafeMode Then outstr = StrCat(outstr,"  ",StrFixLeft(resultcode,"",5))
   outstr = StrCat(outstr,"  ",fname)
   FileWrite(handle,outstr)
EndWhile
SrchFree(hand)
BoxShut()

outstr = StrCat(StrFixLeft(udfAddCommas(sum),"",15),"  ",udfAddCommas(oldc)," files summed")
FileWrite(handle,"")
FileWrite(handle,outstr)
FileWrite(handle,"")
FileWrite(handle,TimeYmdHms())
FileClose(handle)

stop = TimeYmdHms()
Message("Filesearch completed",StrCat("start",@tab,start,@crlf,"stop",@tab,stop))
Exit

:cancel
IntControl(72,2,0,0,0)
Return
Example Output File
___________________________________________________________________________________________________1___________________________________________________________________________________________________2
_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0
12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890

2001:12:28:14:40:12

        Size KB  Owner            Last accessed    Last accessor    Last modified          Filename
             36  DD2              2001:12:28       DD2              2001:02:15:13:58:10    Q:\WinBatch.3rdParty\winbatch crc.zip
            316  DD2              2001:12:28       DD2              2001:02:17:21:18:04    Q:\WinBatch.3rdParty\WILSDK-D4.ZIP
             29  DD2              2001:12:28       DD2              2000:11:28:14:47:34    Q:\WinBatch.3rdParty\winutilsv2.zip
            183  DD2              2001:12:28       DD2              2000:11:27:12:41:54    Q:\WinBatch.3rdParty\progexam.zip
             52  DD2              2001:12:28       DD2              2000:11:28:14:45:34    Q:\WinBatch.3rdParty\Ed_utils.zip
            224  DD2              2001:12:28       DD2              2000:11:28:14:59:06    Q:\WinBatch.2000\postie.zip
            331  DD2              2001:12:28       DD2              2000:11:27:12:53:00    Q:\WinBatch.2000\ctlmgr.zip
            190  DD2              2001:12:28       DD2              2000:11:27:12:52:18    Q:\WinBatch.2000\htmldlg.zip
             44  DD2              2001:12:28       DD2              2000:11:27:12:49:32    Q:\WinBatch.2000\ipgrab.zip
            185  DD2              2001:12:28       DD2              2000:11:27:12:51:30    Q:\WinBatch.2000\netware.zip
            107  DD2              2001:12:28       DD2              2000:11:27:12:50:06    Q:\WinBatch.2000\wwprc32i.zip
...
             12  DD3              2001:12:28       DD3              2001:11:27:23:10:00    Q:\WinBatch.2001\vcheck.zip
            215  DD3              2001:12:28       DD3              2001:11:27:22:49:00    Q:\WinBatch.2001\wwads34i.zip
             51  DD3              2001:12:28       DD3              2001:11:27:22:52:00    Q:\WinBatch.2001\wwcpu34i.zip
          2,287  DD2              2001:12:28       DD2              2001:03:26:21:25:00    Q:\WinBatch.2001\wil-lang.pdf
            526  DD2              2001:12:28       DD2              2001:03:23:23:43:00    Q:\WinBatch.2001\winbatch.pdf
             54  DD3              2001:12:28       DD3              2001:11:27:22:58:00    Q:\WinBatch.2001\wwreg34i.zip
             64  DD3              2001:12:28       DD3              2001:11:29:01:20:00    Q:\WinBatch.2001\wwsop34i.zip
             53  DD3              2001:12:28       DD3              2001:11:27:22:53:00    Q:\WinBatch.2001\wwmap34i.zip
             54  DD3              2001:12:28       DD3              2001:11:27:22:57:00    Q:\WinBatch.2001\wwpar34i.zip
            321  DD3              2001:12:28       DD3              2001:11:27:22:54:00    Q:\WinBatch.2001\wwnwx34i.zip
          1,138  DD3              2001:12:28       DD3              2001:09:06:21:39:00    Q:\WinBatch.2001\eb34i01n.zip
          3,537  DD3              2001:12:28       DD3              2001:09:06:21:40:00    Q:\WinBatch.2001\wb34i01n.zip
            442  DD2              2001:12:28       DD2              2001:02:22:21:20:00    Q:\WinBatch.2001\wwnet32i.zip

         25,554  51 files summed

2001:12:28:14:40:26



Seitenanfang/TopOfPage Seitenende/EndOfPage
Seitenanfang/TopOfPage Seitenende/EndOfPage

Build a report about n days old files on NetWare server (recursive tree walk)

;----------------------------------------------------------------------------------------------------
; udfCreateLogFileFooter (ArrBay)                                            ; 2002:07:17:17:05:27
; udfCreateLogFileHeader (ArrBay)                                            ; 2002:07:17:17:05:27
; udfHeaderScale (len, delimiter)                                            ; 2002:07:17:17:05:27
; udfAddCommas (numstring)                                                   ; 2002:07:17:17:05:27
; udfProcessFile (ArrBay, sFileName)                                         ; 2002:07:17:17:05:27
; udfProcessFolderFiles (ArrBay)                                             ; 2002:07:17:17:05:27
; udfProcessFolderTree (ArrBay, sFolder)                                     ; 2002:07:17:17:05:27
;----------------------------------------------------------------------------------------------------


;------------------------------------------------------------------------------------------------------------------------------------------
; Build a report of files on the NetWare server,
; which were last modified more than x days before now.
; Detlev Dalitz.20020717
;------------------------------------------------------------------------------------------------------------------------------------------

;==========================================================================================================================================
;--- user configurable area begin ---

sLogFileName    = "D:\TEMP\LOG.TXT"      ; Specify a filename for the log file.
sNwServerFolder = "W:\"                  ; UNC name allowed  \\SERVER\SHARE\FOLDER\...
sFolderMask     = "*oo*"                 ; Specify a filter for foldernames.
sFileMask       = "*.exe"                ; Specify a filter for filenames.
iDiffDays       = 90                     ; How old, last modified before x days.
bSafeMode       = 0                      ; Activate safer error checking on file access
iDisplayStep    = 25                     ; Display search activity on every each x steps.
bVerboseMode    = 0                      ; More information about old files

;--- user configurable area end ---
;==========================================================================================================================================

AddExtender('WWNWX34I.DLL')
Gosub DefineUDF
IntControl(5,1,0,0,0)     ; Allow system and hidden files to be counted.
sCurrentFolder = DirGet() ; Save for later restore.
sProcessStart = TimeYmdHms()
sNwServerFolder = StrCat(sNwServerFolder,StrSub("\",(StrSub(sNwServerFolder,StrLen(sNwServerFolder),1)<>"\"),1)) ; Add Backslash for sure.
If (sFolderMask=="") Then sFolderMask="*"

ArrBay = ArrDimension(13)
ArrBay[0]  = sLogFileName
ArrBay[1]  = 0 ; hFW
ArrBay[2]  = 0 ; iFileCountOld
ArrBay[3]  = 0 ; iFileSum
ArrBay[4]  = 0 ; iFileCount
ArrBay[5]  = sFolderMask
ArrBay[6]  = sFileMask
ArrBay[7]  = iDiffDays
ArrBay[8]  = bSafeMode
ArrBay[9]  = iDisplayStep
ArrBay[10] = bVerboseMode
ArrBay[11] = sProcessStart
ArrBay[12] = "" ; sProcessStop

udfCreateLogFileHeader (ArrBay)

BoxOpen(StrCat("Filesearch started ",sProcessStart,"  days diff.=",iDiffDays), "Searching")
udfProcessFolderTree(ArrBay,sNwServerFolder)
BoxShut()

udfCreateLogFileFooter (ArrBay)

ProcessStop = TimeYmdHms()
Message("Filesearch completed",StrCat("start",@tab,sProcessStart,@crlf,"stop",@tab,ProcessStop))

IntControl(5,0,0,0,0)     ; protect System & Hidden files and directories
DirChange(sCurrentFolder) ; back to start folder


; take a look into the logfile
RunZoom(StrCat(DirHome(),"browser.exe"),sLogFileName)
TimeDelay(1)
SendKey("^t!tf!g8~")

Exit

:cancel
IntControl(72,2,0,0,0) ; Sets Cancel handler. Gosub the label :CANCEL
; Do error handling if necessary.
Return


;==========================================================================================================================================
:DefineUDF ; User Defined Functions and User Defined SubRoutines
;==========================================================================================================================================
;
;------------------------------------------------------------------------------------------------------------------------------------------
#DefineFunction udfCreateLogFileFooter (ArrBay)
hFW           = ArrBay[1]
iFileSum      = ArrBay[3]
iFileCountOld = ArrBay[2]

sOut = StrCat(StrFixLeft(udfAddCommas(iFileSum),"",15),"  ",udfAddCommas(iFileCountOld)," files summed")
FileWrite(hFW,"")
FileWrite(hFW,sOut)
FileWrite(hFW,"")
FileWrite(hFW,TimeYmdHms())
FileClose(hFW)
#EndFunction
;------------------------------------------------------------------------------------------------------------------------------------------
#DefineFunction udfCreateLogFileHeader (ArrBay)
sLogFileName  = ArrBay[0]
sFolderMask   = ArrBay[5]
sFileMask     = ArrBay[6]
iDiffDays     = ArrBay[7]
bSafeMode     = ArrBay[8]
sProcessStart = ArrBay[11]

hFW = FileOpen(sLogFileName,"WRITE")
FileWrite(hFW,udfHeaderScale(300,@crlf))
sOut=StrCat('LogFileName    = "',sLogFileName,'"')
FileWrite(hFW,sOut)
sOut=StrCat('FolderMask     = "',sFolderMask,'"')
FileWrite(hFW,sOut)
sOut=StrCat('FileMask       = "',sFileMask,'"')
FileWrite(hFW,sOut)
sOut=StrCat('Day Difference = ',iDiffDays)
FileWrite(hFW,sOut)
FileWrite(hFW,"")
FileWrite(hFW,sProcessStart)
FileWrite(hFW,"")
sOut=""
sOut=StrCat(sOut  ,StrFixLeft("Size KB","",15))
sOut=StrCat(sOut,"  ",StrFix("Accessed","",15))
sOut=StrCat(sOut,"  ",StrFix("Creator" ,"",15))
sOut=StrCat(sOut,"  ",StrFix("Created" ,"",21))
sOut=StrCat(sOut,"  ",StrFix("Modifier","",15))
sOut=StrCat(sOut,"  ",StrFix("Modified","",21))
sOut=StrCat(sOut,"  ",StrFix("Archiver","",15))
sOut=StrCat(sOut,"  ",StrFix("Archived","",21))
If bSafeMode Then sOut = StrCat(sOut,"  ",StrFixLeft("ErrNr","",5))
sOut=StrCat(sOut,"  ","Filename")
FileWrite(hFW,sOut)

ArrBay[1] = hFW
#EndFunction
;------------------------------------------------------------------------------------------------------------------------------------------
#DefineFunction udfHeaderScale (len, delimiter)
p = 0
n = len
While @true
   n = n/10
   If (n==0) Then Break
   p = p+1
EndWhile
sOut = ""
While (p>0)
   sStr = ""
   hmax = 1+(len/(10**p))
   filler = StrFill("_",(10**p)-1)
   For h=1 To hmax
      sStr = StrCat(sStr,filler,h mod 10)
   Next
   sStr = StrSub(sStr,1,len)
   sOut = StrCat(sOut,sStr,delimiter)
   p = p-1
EndWhile
sStr = StrFill("1234567890",len)
sOut = StrCat(sOut,sStr,delimiter)
Return (sOut)
#EndFunction
;------------------------------------------------------------------------------------------------------------------------------------------
#DefineFunction udfAddCommas (numstring)
intpart=ItemExtract(1,numstring, ".")
fractpart=ItemExtract(2,numstring,".")
groups=((StrLen(intpart)-1)/3)+1
answer=""
For y=1 To groups
   If y==1
      ptr=((StrLen(intpart)-1) mod 3)+1
      answer=StrSub(intpart,1,ptr)
      ptr=ptr+1
   Else
      answer=StrCat(answer,",",StrSub(intpart,ptr,3))
      ptr=ptr+3
   EndIf
Next
If (fractpart<>"") Then answer=StrCat(answer,".",fractpart)
Return (answer)
#EndFunction
;------------------------------------------------------------------------------------------------------------------------------------------
#DefineFunction udfProcessFile (ArrBay, sFileName)
hFW             = ArrBay[1]
iFileCountOld   = ArrBay[2]
iFileSum        = ArrBay[3]
iFileCount      = ArrBay[4]
iDiffDays       = ArrBay[7]
bSafeMode       = ArrBay[8]
iDisplayStep    = ArrBay[9]
bVerboseMode    = ArrBay[10]
sProcessStart   = ArrBay[11]

iFileCount = iFileCount+1
sFileName = FileFullname(sFileName)
If FileExist(sFileName)
   If bSafeMode
      LastErrorMode=ErrorMode(@off)
      IntControl(72,2,0,0,0)
      LastError()
      accessed = nwGetFileInfo(sFileName,5,"","",0)
      iResult = LastError()
      ErrorMode(LastErrorMode)
      ; do error handling if necessary

      LastErrorMode=ErrorMode(@off)
      IntControl(72,2,0,0,0)
      LastError()
      modifier = nwGetFileInfo(sFileName,4,"","",0)
      iResult = LastError()
      ErrorMode(LastErrorMode)
      ; do error handling if necessary

      LastErrorMode=ErrorMode(@off)
      IntControl(72,2,0,0,0)
      LastError()
      modified = nwGetFileInfo(sFileName,3,"","",0)
      iResult = LastError()
      ErrorMode(LastErrorMode)
      ; do error handling if necessary

      LastErrorMode=ErrorMode(@off)
      IntControl(72,2,0,0,0)
      LastError()
      Creator = nwGetFileInfo(sFileName,2,"","",0)
      iResult = LastError()
      ErrorMode(LastErrorMode)
      ; do error handling if necessary

      LastErrorMode=ErrorMode(@off)
      IntControl(72,2,0,0,0)
      LastError()
      created = nwGetFileInfo(sFileName,1,"","",0)
      iResult = LastError()
      ErrorMode(LastErrorMode)
      ; do error handling if necessary

      LastErrorMode=ErrorMode(@off)
      IntControl(72,2,0,0,0)
      LastError()
      archived = nwGetFileInfo(sFileName,6,"","",0)
      iResult = LastError()
      ErrorMode(LastErrorMode)
      ; do error handling if necessary

      LastErrorMode=ErrorMode(@off)
      IntControl(72,2,0,0,0)
      LastError()
      archiver = nwGetFileInfo(sFileName,7,"","",0)
      iResult = LastError()
      ErrorMode(LastErrorMode)
      ; do error handling if necessary

   Else
      ;accessed = FileTimeGetEx(sFileName, 3) ; accessed
      ;modified = FileTimeGetEx(sFileName, 2) ; modified
      ;created  = FileTimeGetEx(sFileName, 1) ; created
      archiver = nwGetFileInfo(sFileName,7,"","",0)
      archived = nwGetFileInfo(sFileName,6,"","",0)
      accessed = nwGetFileInfo(sFileName,5,"","",0)
      modifier = nwGetFileInfo(sFileName,4,"","",0)
      modified = nwGetFileInfo(sFileName,3,"","",0)
      creator  = nwGetFileInfo(sFileName,2,"","",0)
      created  = nwGetFileInfo(sFileName,1,"","",0)
   EndIf

   bIsOld = (TimeDiffDays(sProcessStart,modified) > iDiffDays)
Else
   accessed = "unknown"
   Creator  = "unknown"
   created  = "unknown"
   modifier = "unknown"
   modified = "unknown"
   archiver = "unknown"
   archived = "unknown"
   bIsOld = @true
EndIf

If !(iFileCount mod iDisplayStep)
   dispcount = StrCat(StrFix("Count"      ,"",15) ,@tab,udfAddCommas(iFileCount))
   dispname  = StrCat(StrFix("Filename"   ,"",15) ,@tab,sFileName)
   dispacc   = StrCat(StrFix("Accessed"   ,"",15) ,@tab,accessed)
   dispcre   = StrCat(StrFix("Created"    ,"",15) ,@tab,created)
   dispmod   = StrCat(StrFix("Modified"   ,"",15) ,@tab,modified)
   disparch  = StrCat(StrFix("Archived"   ,"",15) ,@tab,archived)
   dispold   = StrCat(StrFix("File is old","",15) ,@tab,bIsOld)
   sOut = StrCat(dispcount,@cr,dispname,@cr,dispacc,@cr,dispcre,@cr,dispmod,@cr,disparch,@cr,dispold)
   If bVerboseMode
      If bIsOld Then sFileNameOld = sFileName
         Else sFileNameOld = ""
      dispfnold = StrCat(StrFix("Filename old"  ,"",15) ,@tab,sFileNameOld)
      dispcreo  = StrCat(StrFix("Creator"       ,"",15) ,@tab,Creator)
      dispmodo  = StrCat(StrFix("Modifier"      ,"",15) ,@tab,modifier)
      disparcho = StrCat(StrFix("Archiver"      ,"",15) ,@tab,archiver)
      dispoldc  = StrCat(StrFix("Count old"     ,"",15) ,@tab,udfAddCommas(iFileCountOld))
      dispsum   = StrCat(StrFix("KB summed old" ,"",15) ,@tab,udfAddCommas(iFileSum))
      dispperf  = StrCat(StrFix("Files/sec"     ,"",15) ,@tab,udfAddCommas(iFileCount/(1+TimeDiffSecs(TimeYmdHms(),sProcessStart))))
      sOut = StrCat(sOut,@cr,@cr,dispoldc,@cr,dispfnold,@cr,dispcreo,@cr,dispmodo,@cr,disparcho,@cr,dispsum,@cr,@cr,dispperf)
   EndIf
   BoxText(sOut)
EndIf

If !bIsOld Then Goto labelreturn

iFileCountOld = iFileCountOld+1
iSizeKB = 0
iFileSize = FileSizeEx(sFileName)
If iFileSize Then iSizeKB = Int(1.0+(iFileSize/1024))
iFileSum = iFileSum + iSizeKB
sOut = ""
sOut = StrCat(sOut,StrFixLeft(udfAddCommas(iSizeKB) ,"",15))
sOut = StrCat(sOut,"  ",StrFix(StrSub(accessed,1,10),"",15))
sOut = StrCat(sOut,"  ",StrFix(Creator              ,"",15))
sOut = StrCat(sOut,"  ",StrFix(created              ,"",21))
sOut = StrCat(sOut,"  ",StrFix(modifier             ,"",15))
sOut = StrCat(sOut,"  ",StrFix(modified             ,"",21))
sOut = StrCat(sOut,"  ",StrFix(archiver             ,"",15))
sOut = StrCat(sOut,"  ",StrFix(archived             ,"",21))
If bSafeMode Then sOut = StrCat(sOut,"  ",StrFixLeft(iResult,"",5))
sOut = StrCat(sOut,"  ",sFileName)
FileWrite(hFW,sOut)

:labelreturn
ArrBay[2] = iFileCountOld
ArrBay[4] = iFileCount
ArrBay[3] = iFileSum

Return
#EndFunction
;------------------------------------------------------------------------------------------------------------------------------------------
#DefineFunction udfProcessFolderFiles (ArrBay)
sFileMask = ArrBay[6]

sFileList = FileItemize(sFileMask)
iFileCount = ItemCount(sFileList,@tab)
For i=1 To iFileCount
   sThisFile = ItemExtract(i,sFileList,@tab)
   udfProcessFile(ArrBay,sThisFile)
Next
Return
#EndFunction
;------------------------------------------------------------------------------------------------------------------------------------------
#DefineFunction udfProcessFolderTree (ArrBay, sFolder)
sFolderMask = ArrBay[5]

sCurrentFolder = DirGet()
DirChange(sFolder)

If StrLenwild(StrLower(sFolder),StrLower(sFolderMask),1) Then udfProcessFolderFiles(ArrBay)

sFolderList = DirItemize("*.*")
iFolderCount = ItemCount(sFolderList,@tab)
For i=1 To iFolderCount
   sThisFolder = ItemExtract(i,sFolderList,@tab)
   udfProcessFolderTree(ArrBay,sThisFolder) ; recursive
Next

DirChange(sCurrentFolder)
Return
#EndFunction
;------------------------------------------------------------------------------------------------------------------------------------------
;
;==========================================================================================================================================
Return ; from gosub DefineUDF ;  User Defined Functions and User Defined SubRoutines
;==========================================================================================================================================



Page Date
2004-05-18
DD-Software
Kapitel zurück / previous Chapter
Main Index
 
Seite zurück / previous page
Backward
Seite vor / next page
Forward
 
Seitenanfang/TopOfPage
Top
Seitenende/EndOfPage
Bottom
MyWbtHelp current version