Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sample VBS

Status
Not open for further replies.

inunix

Technical User
Jul 30, 2002
53
US
Hi

I've a requirement to delete the local files based on timestamp.

Can someone provide a VBS for the above same.?

Else pls guide me how to do the same.

I also have to find the disk usage; for example, free/used memory size for C or E drives...

Please guide me or provide VBS.

Thanks in advance.

: inunix
 
Take a look at the FileSystemObject this do everything you need.

Everybody body is somebodys Nutter.
 
E.G.
Code:
    sWnntProfPath = sHostName & "\c$\WINNT\Profiles"
    Set oFSys = CreateObject("Scripting.FileSystemObject")
    
'    Clean profiles from the 'C:\WINNT\Proflies' directory
    Set oRootProfFolder = oFSys.GetFolder(sWnntProfPath)
    Set oSubProfFolder = oRootProfFolder.SubFolders

        For Each Folder In oSubProfFolder
            
            If Len(Folder.Name) = 7 And IsNumeric(Folder.Name) = True _
            And Folder.DateLastModified < Now - 5 Then
                Folder.Delete True
                m_DeletedProfiles = m_DeletedProfiles + 1
            End If
        Next
[\Code]

Everybody body is somebodys Nutter.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top