File Size

aziz rasul

Active member
Local time
Today, 21:22
Joined
Jun 26, 2000
Messages
1,935
I have the following code in MS Access 2000: -

Dim fs As Variant
Dim FileCount As Integer
Dim j As Variant

Set fs = Application.FileSearch
strImportDir = "D:\NTL\TextFiles_EXP_Import\IN\"

With fs
.NewSearch
.LookIn = strImportDir
.FileName = "OSSPRD2.*.*"
.SearchSubFolders = False
.Execute
For Each j In .FoundFiles
Debug.Print j
Next j
End With

Is it possible to obtain the size of each of the files?
 
Check out the FileLen Function in the help files.

Next you will be asking about the file dates so go ahead can check out the DateCreated & LastUpdated Properties in the help files.

HTH
 
How does the code

Sub ShowFileInfo(filespec)
Dim fs, f, s
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFile(filespec)
s = "Created: " & f.DateCreated
MsgBox s
End Sub

work in order to obtain the value for DateCreated. In other words, what do I right in place of Scripting.FileSystemObject?

The type of files that I use are text files.
 
Try this...

Type this as the Control Source of any text box...

=FileDateTime("C:\Windows\Explorer.exe")

The text box should display the date and time the Explorer.exe file on your PC was created (or last modified).

HTH
 
In regards to your previous question, you do not need to change the function, you need to call the function and provide the location of the file that you want the created date for.

Copy these two functions into a new module and run the Test() function to return the date the Explorer.exe file was created.
Code:
Public Function Test()
    FileCreatedDate ("C:\Windows\Explorer.exe")
End Function
    
    
Public Function FileCreatedDate(sFile As String)
    
    Dim fs As Object
    Dim f As Object
    Dim sDate As String
    
    Set fs = CreateObject("Scripting.FileSystemObject")
    Set f = fs.GetFile(sFile)
    
    sDate = "Created: " & f.DateCreated
    MsgBox sDate
    
End Function
HTH
 
ghudson said:
Check out the FileLen Function in the help files.

Next you will be asking about the file dates so go ahead can check out the DateCreated & LastUpdated Properties in the help files.

HTH

Is there anyway this can be converted from Bytes to MB/GB ?
 

Users who are viewing this thread

Back
Top Bottom