Actually I don't want to delete any files, just directories.

 

Jennifer Shwajlyk

Clinical Programmer Analyst, RN

(518)775-4185

[email protected]

 

 

________________________________

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

 

Give this a try...

 

Function deleteOldFiles(dirPath As String, numDays As Integer)

    Dim myFiles As String

    

    myFiles = Dir(dirPath & "*.*")

    

    Do While myFiles <> ""

        'delete files older than numDays

        If DateDiff("d", FileDateTime(dirPath & myFiles), Now()) >
numDays Then

            Kill dirPath & myFiles

        End If

        myFiles = Dir

    Loop

    

End Function

 

 

Sub main()

    deleteOldFiles "c:\test\", 5

End Sub

Chris Ashcraft

Solutions Development Senior Analyst

Ascension Health Information Services

Sacred Heart Health System

P: (850) 416-4578 - F: (850) 416-7392

 

 

 

 

 

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   

 

---  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   

CONFIDENTIALITY NOTICE: 

This email message and any accompanying data or files is confidential
and may contain privileged information intended only for the named
recipient(s). If you are not the intended recipient(s), you are hereby
notified that the dissemination, distribution, and or copying of this
message is strictly prohibited. If you receive this message in error, or
are not the named recipient(s), please notify the sender at the email
address above, delete this email from your computer, and destroy any
copies in any form immediately. Receipt by anyone other than the named
recipient(s) is not a waiver of any attorney-client, work product, or
other applicable privilege.


---  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>>

<<image002.jpg>>

<<image003.jpg>>

<<image004.jpg>>

Reply via email to