Login | |
|
 |
Script to list all files and properties from directory - 1/31/2008 2:52:40 PM
|
|
 |
|
| |
abracetti
Posts: 2
Score: 0
Joined: 1/31/2008
Status: offline
|
Hi Guys, I'm trying to create a vbs script to run in a folder of a file server to get some details of all the files in that folder, let's say I have 100 users storing files on this server and they have each one access to only one personal folder on the server, but as USERS they do not worry about saving sapce on the server and do not cleanup their files so the server keeps filling up. I wanted to via script create an excel spreadsheet to list all files with some its properties like: Name, Size, Type, Date Created, Date Modified, Last Accessed and Path. With this script I'm trying to list files that have not been accessed for a long time and clear them up , since we have a backup of all this. I already have a script to list the files on the root of the folder but i also wanted to know what is inside the subfolders...... I haven't used much scripting before but nevertheless I was trying to create this script by myself but was getting to the point where i would have to recall the subroutine too many times and was afraid of allocating too much memory for this script and maybe crash the server , not speaking of running out of rows within the excel file........ The basic script I used is the one below but it doesn't go trough subfolders....... Can someone shed some light please??? Dim intRow Set objShell = CreateObject("Shell.Application") Set objFolder = objShell.Namespace("C:\") Set objExcel = CreateObject("Excel.Application") objExcel.Visible = True objExcel.Workbooks.Add intRow = 2 objExcel.Cells(1,1).Value = "Name" objExcel.Cells(1,2).Value = "Size" objExcel.Cells(1,3).Value = "Type" objExcel.Cells(1,4).Value = "Date Created" objExcel.Cells(1,5).Value = "Date Modified" objExcel.Cells(1,6).Value = "Last Accessed" For Each strFileName in objFolder.Items For i = 0 to 6 objExcel.Cells(intRow,i+1).Value = objFolder.GetDetailsOf(strFileName, i) Next intRow = intRow + 1 Next
|
|
| |
|
|
|
|
|