Getting Started with Adobe After Effects - Part 6: Motion Blur


Upload Image Close it
Select File

Share and find various re-usable scripts related to VB Script

Moderators

Visual Basic Scripts

Housekeeping a folder using VBScript

Jul 10 2012 12:00AM by Manas Ranjan Dash   

Most of the time we use script to play with folders in production or in local computer, here is a script to housekeep your folder keeping a retention period of required days.

Option Explicit 
Const srcPath = "\\directory\Sub-directory" 
Const daysLimit= 60
Dim objFSO 

Set objFSO = CreateObject("Scripting.FileSystemObject") 

Sub HousekeepFolder(srcPath, dateLimit)
        Dim objFolderToHousekeep
        Set objFolderToHousekeep = objFSO.GetFolder(srcPath) 
        On Error Resume Next 
        Dim objFile, objFolder 
        For Each objFile In objFolderToHousekeep.Files 
        	If DateDiff("d", CDate(objFile.DateLastModified), Now) > daysLimit Then
    		         objFSO.DeleteFile objFile 
    	        End If 
            Next 
        For Each objFolder In objCurrentFolder.subFolders 
        	HousekeepFolder objFolder, daysLimit
        Next 
End Sub


Manas Ranjan Dash
39 · 5% · 1482
4
 
0
Worked
 
0
Failed
 
0
Lifesaver
 
0
Production
 
0
Unwise



Submit

Your Comment


Sign Up or Login to post a comment.

"Housekeeping a folder using VBScript" rated 5 out of 5 by 4 readers
Housekeeping a folder using VBScript , 5.0 out of 5 based on 4 ratings
    Copyright © Rivera Informatic Private Ltd Contact us      Privacy Policy      Terms of use      Report Abuse      Advertising      [ZULU1097]