#1
|
|||
|
|||
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! |
#2
|
|||
|
|||
Hi
Quote:
Maybe you can give us a hint, what you expect the .csv look like? |
#3
|
|||
|
|||
Hi whatsup!
the .csv file generates an output file (Microsoft Excel Comma Separated Values File) than kyou so much for any help! |
#4
|
|||
|
|||
Hi josianne
Before going into details with your generated .csv - what prevents you from writing the results to a normal Excel-sheet, saving it afterwards as .csv? I think it would be the easier way. If for some reason this doesn't suit you, please post the complete code, and tell what problem you got at the end. I will need to have it tested just by the look of the part you posted I can't see anything wrong |
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 |
Letters change size in folders list | nsv | Outlook | 1 | 08-19-2010 03:48 AM |