Windows Vista Tips

Windows Vista Tips > Newsgroups > Windows Server > Scripting > RE: Script for deleting folders + content in root of D:\ after # days

Reply
Thread Tools Display Modes

RE: Script for deleting folders + content in root of D:\ after # days

 
 
lca1630
Guest
Posts: n/a

 
      01-30-2009
Hey Dirk,

I may need to refine what the script is doing how about just deleting
d:\vsbackups after 1 day. Thanks

"lca1630" wrote:

> Hello,
>
> I am wondering of one of you scripting wizards could help me with a cleanup
> script that delete all folders older than # days in the root of d:\.
>
> I am making backups of my live virtual servers and do not have enough room
> to house more than one copy at a time.
>
> The backups create folders that show the date and time so I have to make
> sure it deletes all in that partition.
>
> Thanks.

 
Reply With Quote
 
 
 
 
Dirk Stegemann
Guest
Posts: n/a

 
      01-30-2009
Hi,

let's have a look what comes out of the magic wand ;-)

Set oFSO = CreateObject("Scripting.FileSystemObject")
idays = 1
sFolder = "d:\vsbackups"

Set oFolder = oFSO.GetFolder(sFolder)
If DateDiff("d", oFolder.DateCreated, Now()) > idays Then
WScript.Echo "folder """ & oFolder.Name & """will be deleted."
' oFolder.delete
End If


Dirk

"lca1630" <> schrieb im Newsbeitrag
news:2094D500-0F4D-49E9-9A60-...
> Hey Dirk,
>
> I may need to refine what the script is doing how about just deleting
> d:\vsbackups after 1 day. Thanks
>
> "lca1630" wrote:
>
> > Hello,
> >
> > I am wondering of one of you scripting wizards could help me with a

cleanup
> > script that delete all folders older than # days in the root of d:\.
> >
> > I am making backups of my live virtual servers and do not have enough

room
> > to house more than one copy at a time.
> >
> > The backups create folders that show the date and time so I have to make
> > sure it deletes all in that partition.
> >
> > Thanks.



 
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Script for deleting folders + content in root of D:\ after # days Dirk Stegemann Scripting 1 01-29-2009 10:46 PM
Deleting root hints via script Jeff Grossman DNS Server 9 07-12-2008 03:28 AM
Deleting folder content older then X days João Forte Scripting 6 08-28-2007 06:30 PM
DFS root not deleting Barb Active Directory 2 06-01-2006 06:34 PM
Deleting folders after SP2 update in ROOT directory? Andrew Windows Update 8 12-04-2004 05:01 PM



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59