All posts by Chad

Deleting Files Recursively by Age Using VBScript

The other day I started scouring the web for a VBScript to use for deleting files that had not been modified for a certain number of days.  I tried several, some of which were designed to delete files in a given folder, some that deleted certain file extensions recursively, but none that did it recursively by age alone.

When I say “age” I mean the DateLateModified property of the file object in question.  In this script, you specify the number of days (most accurate method), and the target folder, and the name of a logfile.txt that you want generated, as well.  With the log file you can look for OK on success and Failed if the delete didn’t work.

I put my scripts in a folder at C:scripts.  I called this one delete.vbs. 

To run this script, copy the code to your favorite text editor, save the file as a .vbs, open a command line to the directory and type “cscript delete.vbs”

Remember to edit:
1. Line 1 which indicates the target folder where files are going to be deleted
2. Line 2 which indicates the logfile that will be created
3. Line 3 which indicates how many days old you’re starting with… files with a DateLastModified OLDER than this date will be deleted permanently.

You should be able to access the logfile after the script runs.

Here’s the code:

VBScript for Recursive Delete
  1. strFolder = "C:\Test"
  2. logfilename = "C:\scripts\testlog.txt"
  3. intDays = 1277
  4. ForAppending = 8
  5. Set objFSO    = CreateObject("Scripting.FileSystemObject")
  6. Set objFolders    = objFSO.GetFolder(strFolder)
  7. objToday        = Now()
  8. objPastDate    = DateAdd("d", intDays*-1, objToday)
  9. Set objOutFile = objFSO.OpenTextFile(logfilename,ForAppending, True)
  10. objOutFile.WriteLine "——————————"
  11. objOutFile.WriteLine "Run at " & Date()
  12. objOutFile.WriteLine "——————————"
  13.  
  14. Recurse objFolders
  15. Sub recurse(ByRef objFolders)
  16.     Set objSubFolders = objFolders.SubFolders
  17.     Set objFiles = objFolders.Files
  18.     For Each File In objFiles
  19.         If File.DateLastModified < objPastDate Then
  20.             On Error Resume Next
  21.             objOutFile.Write "Deleting " & File.Path & "\" & File.Name
  22.             File.Delete
  23.             If Err.Number = 0 then
  24.                 objOutFile.WriteLine "..OK"
  25.             else
  26.                 objOutFile.WriteLine "..Failed"
  27.             end if
  28.             On Error Goto 0
  29.         End If
  30.     Next
  31.     
  32.     For Each Folder In objSubFolders
  33.         recurse Folder
  34.         If Folder.DateLastModified < objPastDate Then
  35.             On Error Resume Next
  36.             objOutFile.Write "Deleting " & Folder.Path & "\" & Folder.Name
  37.             objFSO.DeleteFolder Folder.Path, True
  38.             If Err.Number = 0 then
  39.                 objOutFile.WriteLine "..OK"
  40.             else
  41.                 objOutFile.WriteLine "..Failed"
  42.             end if
  43.             On Error Goto 0
  44.         Else
  45.         End If
  46.     Next
  47.     Set objSubFolders = Nothing
  48.     Set objFiles = Nothing
  49.     
  50. End Sub

The Heidi Birthday Field Trip

Happy Birthday Heidi!  We enjoyed a lovely time with Grandma Heidi at Stan Hywet.  Such a beautiful estate, lovely flowers and buildings, walkways, ponds, and a greenhouse.  The boys were, as usual, the center of the show.

Motion… Motion… Motion… Always they are in motion… And they seem to be great friends.  Keep your eyes on the little ones in blue and orange.  Click any picture for a nice lightbox slideshow.

IMG_0295 IMG_0296

IMG_0298 IMG_0299

IMG_0300 IMG_0301

IMG_0305 IMG_0306

IMG_0319 IMG_0320

IMG_0321 IMG_0322

IMG_0323 IMG_0324

IMG_0325 IMG_0326

IMG_0327 IMG_0328

There were some other beautiful landscapes, in addition to the tireless runner.

IMG_0331 IMG_0308

IMG_0312 IMG_0314 

IMG_0315 IMG_0317

We had a lovely time with the family.  Though the little ones take up most of the pictures, we were accompanied by the birthday girl, Heidi, Cynthia and Chad, Luke and Willow, and Jordan too!  We had a nice lunch in their quaint on-site cafe, and taking a slow meander across the grounds.  Japanese garden above was neat, I hadn’t seen that part before.

Beauty – Another Argument Against Evolution

I find myself frequently saying to myself… “Now there’s another argument against Evolution.”  I’m speaking of Evolution as a worldview, and random chance processes and materialistic philosophy as a possible source for the existing universe.  I think to myself, “Why should anything be aesthetically pleasing?  Why would a sunset be pleasing to the human eye?”

Materialistic Evolution cannot account for a sense of visual pleasure and warm fuzzy feelings when viewing a marvelous sunset.  Last week I flew home from Nashville to Cleveland and had an opportunity to see a sunset from above the clouds.  Just another argument against Evolution.

IMG_0284

IMG_0285

IMG_0286

Recent Snapshots – Love and Loss

An outfit we just loved, complete with new hat.
IMG_0200

Emma the Cat – I woke up to this one morning – Kneading
IMG_0250

The Boy eats breakfast here.  Thinking 1 picture a year to annually remember
IMG_0254

Picking Berries
IMG_0260

IMG_0261

Our Recent Guest – Loved and Let Go

Eating
IMG_0244

With Mommy Ally on his second-to-last day with us
IMG_0278

Asleep in my arms as I said my goodbyes with silent tears
IMG_0281 

IMG_0279

It is better to have loved and lost than never to have loved at all.  I do believe that is true.

For Yer Money

Recorded this evening on my iPhone for your video enjoyment.  Wrote this one for the wife many moons ago.  Just a quick, fun piece on simple love.

Simple songs are far and wide, this one’s for you
I wrote these words down just to sing them with this tune
Now I don’t want to take too much of your time
So just listen to my rhyme

I don’t love you for yer money
I don’t love you for yer good looks
I don’t love you for anything you do
I just love you fer you

Making Up For Mother’s Day

Well, I don’t if you can truly make up for missing Mother’s Day the first time your wife is a mother… Yes, I blew it, totally did nothing for Mother’s Day this year.  I’ll wait while you scream angry epithets at your screen or stare in disbelief as you re-read that last sentence.

You’re right.  How could I?  It’s inexcusable.  After so many years of yearning and longing for motherhood, and I let her down.  I know.  Appalling, isn’t it?

While it is shameful to have done nothing special for Allyson this year, I’ll at least tell you why.  Mother’s Day, if you don’t already know, is always a difficult day for us.  Allyson’s Mom died in 1998.  They were best friends, and thoughts like this creep in every year:

Why did Robin have to die?
Why Allyson’s Mom, when she was such an amazing person?
Why don’t our kids ever get to know her as a grandmother?
Why did it have to work out like this?
Does God even care?

For years we have wanted to have our own biological children.  Trusting the Lord, we  have seen this as His plan, and so have not pursued medical alternatives (not saying those are wrong).  It’s normal, right?  I’ve found most women can deeply identify with the desire to mother children.  It just never worked out for us.  Frustration.  Hurt.  Anger.  Pain.  Repeat.

Doing my best to make up for my huge miss, I went out today and got some plants for Allyson.  Few things make her happier in this world (probably cats and ice cream rank higher).  I wrote her an awful poem, and left these out on the front porch for her to enjoy:

Hibiscus

IMG_0245

Hydrangeas

IMG_0246


Daisies

IMG_0247

Probably didn’t make up for my blunder in missing Mother’s Day, but it may have at least served to soothe the pain a little bit.  Allyson is an amazing woman, and one who deeply loves all the children in her life.  She is a terrific mother, and I can only imagine how she will continue to get even better as the years go by.

So here’s to mothers, and especially the one I’m married to.  So sorry I missed the day, Babe.  I love you, no matter how many kids come and go, and maybe even stay, in our lives.

– Chad

Boys and Their Toys

Never met a kid who didn’t like a Gator.  Naturally, I’m not talking about reptiles, but rather the off-road mini-John Deere yard vehicle.  Daniel’s Gator is in full working condition, and I think Little A. would drive it all day if he could. 

He hasn’t yet mastered the idea of keeping his foot to the pedal, and so the vehicle lurches as he drives over the rough terrain of Daniel’s spacious back yard.  Steering is also a challenge of sorts, but he’s learning.  These two are certainly trouble together, but loads of laughs and joys, as well.  Here they are.

IMG_0236 IMG_0237 IMG_0238 IMG_0239 IMG_0240 IMG_0241 IMG_0242 IMG_0243

Getting Going on the Weekends

We have a breakfast routine here at VollerHaus.  Each day our breakfasts are planned, and the pattern repeats itself every week.  I have the joy of making the breakfasts for the family, and I find the routine has a smoothing effect on our lives.  It gives us something to look forward to the night before, something to talk about with the children, and something steady throughout the weeks.  When all else fails, there’s still breakfast!  🙂

Monday/Thursday: Eggs and Toast
Tuesday/Friday:     Oatmeal and Banana (for Chad and Big Brother, toast/yogurt for Ally)
Wednesday/Sunday: Smoothies and Toast
Saturday: Pancakes!

Pancakes get us going on the weekends, my friends, that’s all there is to it.  I remember growing up, Dad would make waffles on Sunday mornings (i think it was Sundays).  Those days come back to me each time I make pancakes for the family on Saturdays.  If ever we miss this special time, it leaves a gaping hole in the weekend.

The more we grow as a family, the more I love this family, and the more special moments like breakfast become.

How does your family get going on the weekends?

Order in the Court

Order from chaos/disorder does not work for me.  When it comes to the existence of God, or less specifically the existence of a powerful Intelligence, I do not need to look farther than the existing universe.  Evidence abounds in the Earth alone that points definitively to a Creation.  So why do atheists look at the world and then say, “There is no evidence to support or suggest the existence of God?”

This one discussion point leads to a question for all of us.  If there is evidence (the universe), why does a conclusion of Created Order not follow as a deduction?

The question is this: What would you accept as evidence?  If someone refuses to believe based on the evidence, is the evidence insufficient, or is there something wrong with the lens of the observer?  If I show you a rock, let you touch the rock, watch you taste the rock, and hit you with the rock, and you still say to me, “There is no rock,” then any number of things might be true.  You might be insane.  We all might be insane.  We may all just be a bundle of perceptions.  You might not be willing to accept the evidence of the rock’s existence.  However, your unwillingness to admit the rock’s existence is not a determining factor of its reality.

Simply choosing to “believe” a thing exists is not an act of creation or abolition.  The rock I hit you with (depending on your philosophy, of course, but here I’m going with what I consider to be normative) exists, whether or not you believe it.  This brings me back to the argument for the existence of God from the Ordered Universe.

The universe reflects order in many ways.  We have genetic code that works, by and large.  Physics laws are generally reliable.  When you breed a cat with a cat, you get a cat.  Horses can’t mate with fish.  Solar cycles repeat themselves in predictable patterns.  Even our thoughts have general order to them.

Since we know from reliable scientific discovery that human genetics are incredibly complex, why would someone argue that human life could happen any other way than being created by some Intelligence?  Why would a person examine the overwhelming evidence for Created Order and then deny that a Powerful Intelligence was responsible for its existence?

Think through this one example with me… You have 26 twenty-six sided dice.  Each die has every letter of the American English alphabet on it, one letter per side.  Imagine you had a large area in which to roll these dice as many times as you like.  Would they ever land perfectly lined up in order from A to Z?  Of course not.  Is is possible?  I’d have to say Yes, it’s possible.  However, it is plainly reasonable to assume they will never correctly line up.  Even given billions of years.  The odds are astronomical that it would ever happen.

Is the human genome less complex than the alphabet?  I should think not.  A cursory glimpse into the night sky or through a microscope should stew in us a sense of wonder and awe, and should serve as a giant helping of evidence for a Creator.  When cleanly examined by an honest mind, the world and universe lend themselves to the idea of a Creator.  This is apart from a historic, Christian understanding of the Bible.  This idea stands alone, by itself, with what I can only see as a mountain of evidence that a Creator not only exists, but fashioned this here universe.