Import files name to table - name,extension,creation date (1 Viewer)

Magnus1982

Registered User.
Local time
Today, 02:03
Joined
Apr 29, 2017
Messages
41
Hello,


I am lookinh way to import filename from directory in to access tabel. But I want to have imported to 3 sapereate column in tabel file name , extension, creation date.


I found many codes which doing that but all copying file name to one column .


Please help.


Thank you
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 05:03
Joined
Feb 19, 2002
Messages
43,263
To parse the file names, you will need to use the Left(), Mid(), and Right() functions.
 

Galaxiom

Super Moderator
Staff member
Local time
Today, 19:03
Joined
Jan 20, 2009
Messages
12,852
Another way is to use FileSystemObject, which has methods to return what you want without having to parse strings.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 05:03
Joined
Feb 19, 2002
Messages
43,263
I didn't see any FSO property that separates the file name from the extension. Perhaps you could point it out.
 

MarkK

bit cruncher
Local time
Today, 02:03
Joined
Mar 17, 2004
Messages
8,181
Here are some FSO functions that process filenames. The first two, GetBaseName and GetExtensionName will both separate the filename from the extension.
Code:
Sub Test928346912487()
    Const TMP = "C:\Folder\File.txt"
    
    With CreateObject("Scripting.FileSystemObject")
        Debug.Print .GetBaseName(TMP)
        Debug.Print .GetExtensionName(TMP)
        Debug.Print .GetFileName(TMP)
        Debug.Print .GetDriveName(TMP)
        Debug.Print .GetParentFolderName(TMP)
    End With
End Sub
Mark
 

Users who are viewing this thread

Top Bottom