It’s a Girl!!!

On October 23, 2007, in Personal, by Andrew

So, the official word is in. I’m kicking myself for not writing down the ultrasound technician’s name. If she is wrong, she owes me some money for the suffering I have and will have to endure. After the appointment, I came home from work and found pink clothes all over the house. I thought, “It’s starting!”

Truthfully though, I couldn’t be happier. Every day, I think about what she is going to be like. I already know she will be stubborn. And, I have to admit that, she will probably be daddy’s little girl. What can I say, I’m going to be a dad. What girl isn’t daddy’s little girl?

Here is a shot: baby0002.png.

Besides that, nothing much is new. Just enjoying the fact that I am going to be a dad!

Oh yeah, her name… Angelica June. My little angle… I can already hear her saying, “But why daddy, I’m your little angle.”

 

VBScript: Delete Files Older Than One Hour

On October 3, 2007, in Technology, by Andrew

So, I am constantly looking for ways of automating tasks. Too many admins do not take advantage of scripting and scheduled tasks/cron. Just this last week, I was implementing a new print server. Besides just building up the new server, I wanted to actually offer the users something new and useful.

I’ve been wanting to setup a network pdf printer for quite some time. I have played around with setting up a network PDF printer using cups. However, we seem to be so MS centric these days that I decided to use PDFCreator‘s print server. It was really a piece of cake. Just install the server portion, setup the service, create a share and watch the PDF’s spool.

I quickly found that the folder where PDF’s were written to, was quickly filling with PDF’s as users were not removing them. So, the solution was to write a little vbscript to purge any files older than an hour. There were two things I wanted:

  1. I have a file named “!FILES ARE PURGED AFTER ONE HOUR!”. I did not want this file removed. It serves as a warning for uses.
  2. I did not want to purge the folder every hour. I wanted to remove any files that were one hour old or greater. That way, if a user creates a PDF at 2:59pm, the 3:00pm run won’t delete it. It will be deleted on or after 3:59pm.

Here is the script I came up with:

strFolder = "C:\Folder\"
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(strFolder)
Set objFSO = CreateObject("Scripting.FileSystemObject")
 
For Each strFileName in objFolder.Items
    If len(objFSO.GetExtensionName(strFileName)) > 0 Then
        Set objFile = objFSO.GetFile(strFolder & strFileName.Name)
        If DateDiff("N",objFile.DateLastModified,Now()) > 59 Then
            objFSO.DeleteFile(strFolder & strFileName.Name),True
        End If
    End If
Next

The great thing about this is that you get a free network PDF printer that can be left alone. Your boss thinks you are a genius and there is no sweat on your brow.

Cheers!

Tagged with: