Solved

Convert what you see in a folder in Windows Explorer (Details View) into an Excel spreadsheet.

Posted on 2010-08-23
8
722 Views
Last Modified: 2012-05-10
Is it possible to convert what you see in a folder in Windows Explorer (Details View) into an Excel spreadsheet?

Hence, the Excel spreadsheet will have a list of

- Filenames under Name column,
- dates under Date modified column
- file type  under type column
- file size under size column

I'm not sure which Zone this question belongs to. I hope this is the correct one.

Thanks!
0
Comment
Question by:jeremyll
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
8 Comments
 
LVL 42

Expert Comment

by:sedgwick
ID: 33498678
yes, i can post a vb script which accept the folder path as argument and export to excel list all the columns u mentioned.is this solution good for you?
0
 
LVL 42

Expert Comment

by:sedgwick
ID: 33498710
check the screenshot
Untitled.jpg
0
 
LVL 42

Expert Comment

by:sedgwick
ID: 33498860
here's the script.there are few constants in the script that you might want to change:FOLDER_PATH -> the folder from which the files properties are being exported to the excel worksheet,OUTPUT_EXCEL_FILE -> the output excel file pathto run the script yu have 2 options:via command line:cscript script_path.vbsvia windows explorer:right click on the script file -> Open With -> Microsoft Windows Based Script Host
Const FOLDER_PATH = "c:\temp\files"
const OUTPUT_EXCEL_FILE = "c:\temp\output.xlsx"
const SHEET_HEADERS = "Name, Date Modified, Type, Size"
Const xlExcel7 = 51

On Error Resume Next
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = false
 
If (Err.Number <> 0) Then
    On Error GoTo 0
    Wscript.Echo "Excel application not found."
    Wscript.Quit
End If
On Error GoTo 0

col=1
row=2

' Create a new workbook.
objExcel.Workbooks.Add

' Bind to worksheet.
Set objSheet = objExcel.ActiveWorkbook.Worksheets(1)
objSheet.Name = Replace(Replace(FOLDER_PATH, ":\", "-"), "\","-")

for each header in Split(SHEET_HEADERS,",")
	objSheet.Cells(1, col).Value = header
	col=col+1
next

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(FOLDER_PATH)
For Each objFile in objFolder.Files
	objSheet.Cells(row, 1).Value = objFile.Name
	objSheet.Cells(row, 2).Value = objFile.DateLastModified
	objSheet.Cells(row, 3).Value = objFile.Type
	objSheet.Cells(row, 4).Value = objFile.Size & " KB"
	row=row+1
Next

objExcel.DisplayAlerts = False
objExcel.ActiveWorkbook.SaveAs OUTPUT_EXCEL_FILE, xlExcel7
objExcel.ActiveWorkbook.Close false

' Quit Excel.
objExcel.Application.Quit

Set objSheet = Nothing
Set objExcel = Nothing

Wscript.Echo "done."

Open in new window

0
Transaction Monitoring Vs. Real User Monitoring

Synthetic Transaction Monitoring Vs. Real User Monitoring: When To Use Each Approach? In this article, we will discuss two major monitoring approaches: Synthetic Transaction and Real User Monitoring.

 

Author Comment

by:jeremyll
ID: 33506856
I received an error message after I ran the script

via windows explorer:
right click on the script file -> Open With -> Microsoft Windows Based Script Host

Please see attached screenshot
windowsScriptError.gif
0
 
LVL 42

Accepted Solution

by:
sedgwick earned 500 total points
ID: 33508106
try now.
Const FOLDER_PATH = "c:\temp\files"
const OUTPUT_EXCEL_FILE = "c:\temp\output.xlsx"
const SHEET_HEADERS = "Name, Date Modified, Type, Size"
Const xlExcel7 = 51

On Error Resume Next
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = false
 
If (Err.Number <> 0) Then
    On Error GoTo 0
    Wscript.Echo "Excel application not found."
    Wscript.Quit
End If
On Error GoTo 0

col=1
row=2

' Create a new workbook.
objExcel.Workbooks.Add

' Bind to worksheet.
Set objSheet = objExcel.ActiveWorkbook.Worksheets(1)

for each header in Split(SHEET_HEADERS,",")
	objSheet.Cells(1, col).Value = header
	col=col+1
next

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(FOLDER_PATH)
For Each objFile in objFolder.Files
	objSheet.Cells(row, 1).Value = objFile.Name
	objSheet.Cells(row, 2).Value = objFile.DateLastModified
	objSheet.Cells(row, 3).Value = objFile.Type
	objSheet.Cells(row, 4).Value = objFile.Size & " KB"
	row=row+1
Next

objExcel.DisplayAlerts = False
objExcel.ActiveWorkbook.SaveAs OUTPUT_EXCEL_FILE, xlExcel7
objExcel.ActiveWorkbook.Close false

' Quit Excel.
objExcel.Application.Quit

Set objSheet = Nothing
Set objExcel = Nothing

Wscript.Echo "done."

Open in new window

0
 

Author Comment

by:jeremyll
ID: 33517801
Thanks Sedgewick, your help is much appreciated.

I tried the above, but I'm still getting errors.

I've attached the vbs file that i tried to run and screenshot of the error.
convert2Excel.vbs
scriptError.gif
0
 
LVL 42

Assisted Solution

by:sedgwick
sedgwick earned 500 total points
ID: 33518460
open the .vbs file in notepad.
save it as ANSI (keep the same file anem and extension) and try run it again.
0
 

Author Closing Comment

by:jeremyll
ID: 33518546
Incredible!

Thanks so much Sedgewick!
0

Featured Post

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
Citrix XenApp, Internet Explorer 11 set to Enterprise Mode and using central hosted sites.xml file.
This video Micro Tutorial explains how to clone a hard drive using a commercial software product for Windows systems called Casper from Future Systems Solutions (FSS). Cloning makes an exact, complete copy of one hard disk drive (HDD) onto another d…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question