Save this file as a .vbs and put the full directory path in the
"sDirectoryPath" variable and change the "iDaysOld" to the timeframe you
want.  Then you can call from a Boston Script, or set for a scheduled
task.

 

Remove_Old()

Sub Remove_Old()

Dim strArch

 

iDaysOld = 60

 

Set oFSO = CreateObject("Scripting.FileSystemObject")

sDirectoryPath = "full file name"

set oFolder = oFSO.GetFolder(sDirectoryPath)

Set oFileCollection = oFolder.Files

 

For Each oFile in oFileCollection

                If oFile.DateLastModified < (Date() - iDaysOld) Then

                                oFile.Delete(True)

                End If

Next

 

'Clean up

Set oFSO = Nothing

Set oFolder = Nothing

Set oFileCollection = Nothing

Set oFile = Nothing

 

End Sub

 

 

 

Bruce Broaddus

Revenue Cycle Programmer

Stormont-Vail Health Care

785-354-5485

[email protected]

 

 

From: [email protected] [mailto:[email protected]] 
Sent: Friday, November 18, 2011 8:37 AM
To: [email protected]
Subject: [talkbws] script to delete folders and files older than a
specified number of days

 

Does anyone have a script that deletes folders as well as files older
than a specified number of days?

 

TIA!

 

Jennifer Shwajlyk

Clinical Programmer Analyst, RN

(518)775-4185

[email protected]

 

 

 

 

---  To post a message to this list, send mail to: [email protected]
You are currently subscribed as: [email protected]
Unsubscribe in the customer center on our website: 
http://www.bostonworkstation.com/customer_center/virtual_user_group_talk
.aspx   


NEED A DOCTOR?  Stormont-Vail's Health Connections can help you find a doctor 
accepting new patients.  Call (785) 354-5225.

******************************************************************************************************************

The information transmitted in this e-mail and in any replies and forwards are 
for the sole use of the above individual(s) or entities and may contain 
proprietary, privileged and/or highly confidential information.  Any 
unauthorized dissemination, review, distribution or copying of these 
communications is strictly prohibited.  If this e-mail has been transmitted to 
you in error, please notify and return the original message to the sender 
immediately at the above listed address.  Thank you for your cooperation.

******************************************************************************************************************

---  To post a message to this list, send mail to: [email protected]    You are 
currently subscribed as: [email protected]    Unsubscribe in the 
customer center on our website: 
http://www.bostonworkstation.com/customer_center/virtual_user_group_talk.aspx   

<<image001.jpg>>

Reply via email to