Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 08-14-2014, 03:51 AM
josianne josianne is offline list folders and files using .vbs file Windows 7 32bit list folders and files using .vbs file Office 2010 32bit
Novice
list folders and files using .vbs file
 
Join Date: Aug 2014
Posts: 2
josianne is on a distinguished road
Default list folders and files using .vbs file


Hello guys!
I'm very new on programming but I'm enjoying it so far .
I need help to make a vbs file that returns a list of files and subfolders of main folder
SO FAR I HAVE THIS (but it doesnt separates the fields in different columns)

Code:
Dim fso
Dim ObjOutFile 

Set fso = CreateObject("Scripting.FileSystemObject") 

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

ObjOutFile.WriteLine("Type,File Name,File Path")

GetFiles("C:\Intel") 

ObjOutFile.Close 
WScript.Echo("Completed")
Function GetFiles(FolderName) 
On Error Resume Next 
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," & ObjFile.Name & "," & ObjFile.Path) 
Next 

Set ObjSubFolders = ObjFolder.SubFolders 
For Each ObjFolder In ObjSubFolders 

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

GetFiles(ObjFolder.Path) 
Next 
End Function

Thanks in advance all you guys!
You'll have a very thankfull girl posting here!
Reply With Quote
 

Tags
file, folder, list



Similar Threads
Thread Thread Starter Forum Replies Last Post
The powerpoint icon on the task bar hides pptx files in the recent files list Innovationgame PowerPoint 0 11-13-2013 09:03 AM
copy, sync files across 2 folders 1 pc spgprivate Office 0 06-20-2013 08:41 AM
How to re-link default email acct folders to default Outlook Data File folders? RDA1959 Outlook 0 03-26-2012 10:55 AM
Macro to List out all the Sub folders Ram1989 Excel Programming 0 02-27-2012 12:33 AM
list folders and files using .vbs file Letters change size in folders list nsv Outlook 1 08-19-2010 03:48 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 07:38 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft