It's a backup folder. I do a diferential backup everyday, and i want to remove all old backup but not the firts backup done, because it's necessary to restore.
Thanks.
Main Topics
Browse All TopicsHello,
I wan to erase files older than 30 days except four in my windows 2003 server. I find the following script in other post, but i don't now how to modify it for do file exceptions.
Const ForAppending = 8
strSourceFolder = "C:\Testing"
strLog = "C:\FilesRemoved.Log"
Dim objFSO : Set objFSO = CreateObject("Scripting.Fi
Dim objOutputFile : Set objOutputFile = objFSO.CreateTextFile(Repl
With objOutputFile
.WriteLine "=========================
.WriteLine "Removal summary for " & Date
.WriteLine "=-=-=-=-=-=-=-=-=-=-=-=-=
.WriteLine
End With
'intDel is the number of days old you want to check for. I set it to 1 for testing.
intDel = 30
dtOld = DateAdd("d", -intDel, Date)
Set objFolders = objFSO.GetFolder(strSource
'Get the files in the current folder
For Each fil In objFolders.Files
'If a file exists that hasn't been accessed in intDel days or more, delete it
If DateDiff("d", fil.DateCreated, dtOld) >= intDel Then
objOutputFile.WriteLine fil.Path & " was removed at " & Now
objFSO.DeleteFile fil.Path
End If
Next
With objOutputFile
.WriteLine
.WriteLine "Process completed at " & Now
.WriteLine "=========================
.Close
End With
Set objOutputFile = Nothing
Set objFSO = Nothing
wscript.quit
Thanks for your help.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Business Accounts
Answer for Membership
by: EddieShipmanPosted on 2009-04-01 at 09:01:47ID: 24040626
What are the exceptions that make you want to keep those four files? Or, are you saying you want to remove
all but four files that are older than 30 days?