Home > Software engineering >  VB2008 access folder modification time of the latest file name
VB2008 access folder modification time of the latest file name

Time:09-27

As A topic in A folder contains several text files, how to obtain the file modification time of the latest file into the variable A beg god give A code grateful ~ ~

CodePudding user response:

Both Dim files
=My.Com puter. FileSystem. GetFiles (" D: \ temp \ ", FileIO SearchOption. SearchAllSubDirectories, "*.txt) 
Dim lastFI As the FileInfo=Nothing
For Each s As String files In
Dim FI As the FileInfo=My.Com puter. FileSystem. GetFileInfo (s)
If (lastFI Is Nothing) OrElse (FI) LastWriteTime & gt; LastFI. LastWriteTime) Then
LastFI=FI
End the If
Next
The Debug. Print (" {0} {1} ", lastFI. FullName, lastFI. LastWriteTime)
A=lastFI. FullName

CodePudding user response:

 Shell "CMD/dir/o c - d/a, d/b d: \ temp \ *. * & gt; D: \ files. TXT ", vbHide 
'd read file: \ files. TXT the content of the first line of the required
  • Related