("Set fso=CreateObject("Scripting.FileSystemObject
(Set fld = fso.GetFolder(strSourcePath
For Each sfldr in fld.Subfolders
Debug.Print sfldr.Name
Next
گرفتن فایل های داخل فولدر
Set fls=fld.Files
For Each f In fls
Debug.Print f.Name
Next
| Method | Description |
| CopyFile | Used to copy an existing file. |
| CopyFolder | Used to copy an existing folder. |
| CreateFolder | Used to create a folder. |
| CreateTextFile | Used to create a text file. |
| DeleteFile | Used to delete a file. |
| DeleteFolder | Used to delete a folder. |
| DriveExists | Used to determine whether a drive exists. |
| FileExists | Used to determine whether a file exists. |
| FolderExists | Used to determine whether a folder exists. |
| GetAbsolutePathName | Used to return the full path name. |
| GetDrive | Used to return a specified drive. |
| GetDriveName | Used to return the drive name. |
| GetFile | Used to return a specified file. |
| GetFileName | Used to return the file name. |
| GetFolder | Used to return a specified folder. |
| GetParentFolderName | Used to return the name of the parent folder. |
| GetTempName | Used to create and return a string representing a file name. |
| MoveFile | Used to move a file. |
| MoveFolder | Used to move a folder. |
| OpenTextFile | Used to open an existing text file |
r = Range("A65536").End(xlUp).Row + 1
For Each FileItem In SourceFolder.Files
'Display file properties
Cells(r, 1).Formula = FileItem.Name
Cells(r, 2).Formula = FileItem.Path
Cells(r, 3).Formula = FileItem.Size
Cells(r, 4).Formula = FileItem.DateCreated
Cells(r, 5).Formula = FileItem.DateLastModified
r = r + 1
Next FileItem