Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
DateTime from filer...
Message
From
23/09/2005 10:45:41
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
23/09/2005 10:20:01
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 7 SP1
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01052185
Message ID:
01052386
Views:
8
>Sergey:
>
>I should have been more specific.
>I can create the filer object with oFiler = CreateObject("file.fileutil") but I can't seem to create the oFile object with the DateTime property. I need to return the datestamp from a specific file, say "c:\temp.dbf".
>
>Thanks
>Luke

Luke,
Sergey gave the right answer.
lnFiles = GetTree('c:\','temp.dbf')
Browse

Function GetTree
  Lparameters tcStartDir,tcSkeleton,tlSubfolders, ;
    tcSearchText1, tcSearchText2, tcSearchText3, ;
    tlSearchAnd, tlWholeWords, tlWithCase
  tcStartDir = Iif(Empty(m.tcStartDir),Sys(5)+Curdir(),m.tcStartDir)
  tcSkeleton = Iif(Empty(m.tcSkeleton),'*.*',m.tcSkeleton)
  tcSearchText1 = Iif(Empty(m.tcSearchText1), '', m.tcSearchText1)
  tcSearchText2 = Iif(Empty(m.tcSearchText2), '', m.tcSearchText2)
  tcSearchText3 = Iif(Empty(m.tcSearchText3), '', m.tcSearchText3)

  Create Cursor filelist ;
    (filepath m, filename m, ;
    filesize i, fattr c(8), createtime T, lastacc T, lastwrite T)
  oFiler = Createobject('filer.fileutil')
  With oFiler
    .SearchPath  = m.tcStartDir
    .SearchText1 = m.tcSearchText1
    .SearchText2 = m.tcSearchText2
    .SearchText3 = m.tcSearchText3
    .SearchAnd   = Iif(m.tlSearchAnd,1,0)
    .IgnoreCase  = Iif(m.tlWithCase,0,1)
    .WholeWords  = Iif(m.tlWholeWords,1,0)
    .Subfolder   = m.tlSubfolders  && Check subfolders
    .SortBy = 5        && Sort by LastWriteTime
    .SortDirection = 1 && Descending 0-Ascending
    .FileExpression = tcSkeleton && Search for skeleton
    .Find(0)

    For ix=1 To .Files.Count
      With .Files(ix)
        If !(Bittest(.Attr,4) And .Name = '.')
          Insert Into filelist ;
            (filepath, filename, filesize, fattr, createtime, lastacc, lastwrite)  ;
            values ;
            (.Path, .Name, .Size, Attr2Char(.Attr), ;
            Num2Time(.Datetime), Num2Time(.LastAccessTime), Num2Time(.LastWriteTime))
        Endif
      Endwith
    Endfor
    Return .Files.Count
  Endwith

Function Num2Time
  Lparameters tnFloat
  Return Dtot({^1899/12/30}+Int(m.tnFloat))+86400*(m.tnFloat-Int(m.tnFloat))

Function Attr2Char
  Lparameters tnAttr
  Return ;
    IIF(Bittest(m.tnAttr,0),'RO','RW')+;
    IIF(Bittest(m.tnAttr,1),'H','_')+;
    IIF(Bittest(m.tnAttr,2),'S','_')+;
    IIF(Bittest(m.tnAttr,4),'D','_')+;
    IIF(Bittest(m.tnAttr,5),'A','_')+;
    IIF(Bittest(m.tnAttr,6),'E','_')+;
    IIF(Bittest(m.tnAttr,7),'N','_')
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform