Read filename and paste the information to excel

Hi Guys,

I want to create a robot to extract all the filename inside the folder and copy the information into the excel sheet such as (name, date, size, type, and etc.)
Is there any solution for this?

Thank You…

Hi @Amin

You can use Directory.GetFiles(folder path) to get file list in a folder,
and refer to below method to get information of each file.
fileinfo = New FileInfo(filename)
name = fileinfo.Name
date = fileinfo.LastWriteTime or fileinfo.CreationTime
size = fileinfo.Length
type = fileinfo.Extension

4 Likes

@wusiyangjia
Is that can be done for the sub-folder?
Means that, read the folder and get the information about the sub-folder.

Hi @Amin

If you want get files of all the sub-folders,
you should add SearchOption parameter when using Directory.GetFiles method.
Directory.GetFiles(“C:\”, “.”, SearchOption, SearchOption.AllDirectories)

2 Likes