Jump to content
Fórum Script Brasil
  • 0
Sign in to follow this  
josianne

listar subpastas e ficheiros de pasta principal

Question

Oi galera!

sou muito nova na programaçao em vba, mas estou adorando esse novo objectivo!

necessito de ajuda para produzir um ficheiro .vbs que devolva um excel com todas as subpastas e ficheiros dentro da pasta principal

name, LastDateModified, size, path, numoffiles

podem ajudar por favor?

obrigada!

até agora o q tenho é isso:

Dim fso
Dim ObjOutFile

Set fso = CreateObject("Scripting.FileSystemObject")

Set ObjOutFile = fso.CreateTextFile("OutputFiles.csv")

ObjOutFile.WriteLine("Type" & vbTab & "Name" & vbTab & "File Path")

GetFiles("C:\Intel")

ObjOutFile.Close
WScript.Echo("Completed")
Function GetFiles(FolderName)

Dim ObjFolder
Dim ObjSubFolders
Dim ObjSubFolder
Dim ObjFiles
Dim ObjFile
Set ObjFolder = fso.GetFolder(FolderName)
Set ObjFiles = ObjFolder.Files

For Each ObjFile In ObjFiles
ObjOutFile.WriteLine("File " & vbTab & ObjFile.Name & vbTab & ObjFile.Path)
Next

Set ObjSubFolders = ObjFolder.SubFolders
For Each ObjFolder In ObjSubFolders

ObjOutFile.WriteLine("Folder " & vbTab & ObjFolder.Name & vbTab & ObjFolder.Path)

GetFiles(ObjFolder.Path)
Next
End Function

Share this post


Link to post
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

Cloud Computing


  • Forum Statistics

    • Total Topics
      148139
    • Total Posts
      643455
×
×
  • Create New...