Hi Guys, doing a bit of network maintenance at the moment and I'd like to
archive some folders that havn't been accessed/modified since 2003.

I would like to generate a script to search a directory and output the names
of all the folders that have not been accessed since 2003 to a txt file.
The text document should also contain when the folders were last accessed.

The server uses NTFS.

Re: Folder last accessed / modified by Steven

Steven
Fri Feb 17 07:23:46 CST 2006

Here you go :o)

'// List_folders.vbs
Option Explicit
Const fsoForWriting = 2
Const fsoForAppending = 8

Dim sInitPath: sInitPath = "./"
Dim sOutputFile: sOutputFile = "folder_list.txt"

SearchFolders sInitPath
WScript.Echo "Okie, I'm finished"

Sub SearchFolders(sInitPath)
Dim objFSO, objFldr, objSFldr, dDate
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFldr = objFSO.GetFolder(sInitPath)

dDate = Year(objFldr.DateLastModified)
If Clng(dDate) < 2004 Then
AddToFile sOutputFile, dDate & " " & objFldr
End If

'// Interate through the sub-folders
For Each objSFldr In objFldr.SubFolders
Call SearchFolders(objSFldr)
Next
Set objFSO = Nothing
End Sub

Function AddToFile(strFile, strData)
Dim objFSO, objTextStream
Set objFSO = CreateObject("scripting.filesystemobject")
'// Open the text file
Set objTextStream = objFSO.OpenTextFile(strFile, fsoForAppending, True)
'//Display the contents of the text file
objTextStream.WriteLine strData
'// Close the file and close FSO object
objTextStream.Close: Set objTextStream = Nothing: Set objFSO = Nothing
End Function

Pre-VBS'd

http://downloads.mysteryfcm.co.uk/scripts/list_folders.vbs

--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

"Chris" <a@b.com> wrote in message
news:OqguCM7MGHA.3708@TK2MSFTNGP09.phx.gbl...
> Hi Guys, doing a bit of network maintenance at the moment and I'd like to
> archive some folders that havn't been accessed/modified since 2003.
>
> I would like to generate a script to search a directory and output the
names
> of all the folders that have not been accessed since 2003 to a txt file.
> The text document should also contain when the folders were last accessed.
>
> The server uses NTFS.
>
>