Monthly Archives: May 2006
Best Man’s Speech drops out of google and others
| 23/5/2006 | Posted by Pete under General |
Alas, it seems that my Best Man’s Speech has fallen out of Google. For a time I was in the top ten hits when searching for “best mans speech” in google.
I have also started a new job in west London, working for a charity called St Dunstans as an assistant database administrator. I hope to post more of what it like working for a charity organisation. So far the experience has been nothing but positive.
It does however mean a 45 minute journey in, which is not ideal, but perfectly doable. Also, on the same note I have made a few changes to the site, which hopefully will improve the layout and readability, as well as a few nice changes in the backend, which you won’t notice.
I’ve got nothing to rant about at the moment, although I’ll shortly be telling my experiences trying to get to grips with “Getting Things Done”. I refuse to link the above text, as I don’t want to give too much away as yet.
ÂSimilar Posts:
Reminder
| 16/5/2006 | Posted by Pete under General |
This is a reminder to myself to look at http://mind.sourceforge.net/
Similar Posts:
How to clean directories in Windows using Visual Basic Script
| 15/5/2006 | Posted by Pete under General |
Copy the text below into notepad and save as cleanfiles.vbs
You can then run the job with parameters, or as a schedule in windows Task Manager. It will remove files according to the specification fed on the command line. For instance use
wscript cleanfiles.vbs c:\temp 0
to clear out the temp directory on the c: drive. Change the number to determine how old files must be before being deleted. See full post for more details
‘ Usage: wscript cleanfiles.vbs [-r]|[-d]
Option Explicit
‘On Error Resume Next
Dim fso, PathToClean, numberOfDays, folder, rootFolder, objFolder, objSubfolders
Dim objFiles, folderToClean, folderToCheck,objArgs, fileFilter, numArgs, recursive, deleteDirsSet objArgs = Wscript.Arguments
If objArgs.count < 3 Then
'Wscript.echo "Usage: wscript cleanfiles.vbs [-r]|[-d]"
Wscript.Quit 1
End IfnumArgs = 0If objArgs.count > (3 + numArgs) And objArgs(numArgs) = “-r” Then
recursive = 1
numArgs = numArgs + 1
End IfIf objArgs.count > (3 + numArgs) And objArgs(numArgs) = “-d” Then
deleteDirs = 1
recursive = 1
numArgs = numArgs + 1
End IfPathToClean = objArgs(numArgs)
fileFilter = objArgs(numArgs+1)
numberOfDays = Cint(objArgs(numArgs+2))Set fso = CreateObject(“Scripting.FileSystemObject”)
‘Start at the folder specified and walk down the directory tree
Set rootFolder = fso.GetFolder(PathToClean)
If Err.Number > 0 Then
‘Wscript.echo “Invalid directory path. Please correct the path and run the script again.”
Wscript.Quit 2
End IfIf recursive > 0 Then
GetSubfolders(rootFolder)
End If
CleanupFiles(rootFolder)‘Clean up
Set fso = NothingWscript.Quit
Sub GetSubfolders(folder)
Dim oSubfolder
Set objFolder = fso.GetFolder(folder)
Set objSubfolders = objFolder.Subfolders
Set objFiles = objFolder.FilesFor Each oSubfolder in objSubfolders
‘Recursively go down the directory tree
GetSubfolders(oSubfolder.Path)‘Cleanup any files that meet the criteria
CleanupFiles(oSubfolder.Path)‘Delete the folder if its empty
If deleteDirs > 0 Then
CleanupFolder(oSubfolder.Path)
End If
Next
End SubSub CleanupFiles(folderToClean)
dim objFile
set objFolder = fso.GetFolder(folderToClean)
set objFiles = objFolder.Files
For Each objFile in objFiles
If (DateDiff(“d”, objFile.DateLastModified, Now) > numberOfDays) or (numberOfDays = 0) Then
If CompareFileName(objFile.Name,fileFilter) Then
objFile.Delete
End If
End If
Next
Set objFolder = Nothing
Set objFiles = Nothing
End SubSub CleanupFolder(folderToCheck)
Set objFolder = fso.GetFolder(folderToCheck)
Set objSubfolders = objFolder.Subfolders
Set objFiles = objFolder.FilesIf objFiles.Count = 0 and objSubfolders.Count = 0 Then
objFolder.Delete
End IfSet objFolder = Nothing
Set objSubfolders = Nothing
Set objFiles = Nothing
End SubPrivate Function CompareFileName (ByVal Name, ByVal Filter) ‘ (recursive)
CompareFileName = False
Dim np, fp: np = 1: fp = 1
Do
If fp > Len(Filter) Then CompareFileName = np > len(name): Exit Function
If Mid(Filter,fp) = “.*” Then ‘ special case: “.*” at end of filter
If np > Len(Name) Then CompareFileName = True: Exit Function
End If
If Mid(Filter,fp) = “.” Then ‘ special case: “.” at end of filter
CompareFileName = np > Len(Name): Exit Function
End If
Dim fc: fc = Mid(Filter,fp,1): fp = fp + 1
Select Case fc
Case “*”
CompareFileName = CompareFileName2(name,np,filter,fp)
Exit Function
Case “?”
If np < = Len(Name) And Mid(Name,np,1) <> “.” Then np = np + 1
Case Else
If np > Len(Name) Then Exit Function
Dim nc: nc = Mid(Name,np,1): np = np + 1
If Strcomp(fc,nc,vbTextCompare)<>0 Then Exit Function
End Select
Loop
End FunctionPrivate Function CompareFileName2 (ByVal Name, ByVal np0, ByVal Filter, ByVal fp0)
Dim fp: fp = fp0
Dim fc2
Do ‘ skip over “*” and “?” characters in filter
If fp > Len(Filter) Then CompareFileName2 = True: Exit Function
fc2 = Mid(Filter,fp,1): fp = fp + 1
If fc2 <> “*” And fc2 <> “?” Then Exit Do
Loop
If fc2 = “.” Then
If Mid(Filter,fp) = “*” Then ‘ special case: “.*” at end of filter
CompareFileName2 = True: Exit Function
End If
If fp > Len(Filter) Then ‘ special case: “.” at end of filter
CompareFileName2 = InStr(np0,Name,”.”) = 0: Exit Function
End If
End If
Dim np
For np = np0 To Len(Name)
Dim nc: nc = Mid(Name,np,1)
If StrComp(fc2,nc,vbTextCompare)=0 Then
If CompareFileName(Mid(Name,np+1),Mid(Filter,fp)) Then
CompareFileName2 = True: Exit Function
End If
End If
Next
CompareFileName2 = False
End Function
Similar Posts:
- Scripts
- Removing obstacles
- How to leave a good comment, and lasting impression on someone’s site
- The almost compulsory Google Chrome post
- Mac Mini
Recent Comments