Archive for August, 2010

Compression utility…

Posted: August 19, 2010 in Utilities
Tags: , ,

I came into a problem where I needed to compress each and every file in a directory. The top directory contained several sub-directories, each containing several sub-directories…Compressing each and every of the few hundred files by hand is obviously tedious. So I wrote a small vbs utility to do the job.

‘Daysen Veerasamy
’12 May 2009
‘Archives all files in top-dir(incl sub-dirs) to dest-dir
Dim objFSO
Set objFSO = CreateObject(“Scripting.FileSystemObject”)
LogFile = “c:\users\daysenv\desktop\files.log”
Dim objLogFile:Set objLogFile = objFSO.CreateTextFile(LogFile, 2, True)
objStartFolder = Wscript.Arguments.Item(0)
arcDest = Wscript.Arguments.Item(1)
pass = Wscript.Arguments.Item(2)
Set objFolder = objFSO.GetFolder(objStartFolder)
‘objLogFile.Write objFolder.Path
‘objLogFile.Writeline
Set colFiles = objFolder.Files
For Each objFile in colFiles
‘objLogFile.Write objFile.Name
‘objLogFile.Writeline
archive objFile.Name, arcDest, objFolder.Path, pass
Next
ShowSubfolders objFSO.GetFolder(objStartFolder)
Sub ShowSubFolders(Folder)
For Each Subfolder in Folder.SubFolders
‘objLogFile.Write Subfolder.Path
‘objLogFile.Writeline
Set objFolder = objFSO.GetFolder(Subfolder.Path)
Set colFiles = objFolder.Files
For Each objFile in colFiles
‘objLogFile.Write (objFolder.Path & “\” & objFile.Name)
‘objLogFile.Writeline
archive objFile.Name,  arcDest, objFolder.Path, pass
Next
ShowSubFolders Subfolder
Next
End Sub
Sub archive(fname, fdest, odest, passwd)
Dim wshShell
Set wshShell  = Wscript.CreateObject(“WScript.shell”)
‘wscript.echo “rar ” & “a” & ” ” & “-df” & ” ” & “-p” & passwd & ” ” & “-hp” & passwd & ” ” & “-ep” & ” ” & “-ep1″ & ” ” & ” ” & “-v700000″ & ” ” & ” ” & fdest & “\” & fname & “.rar” & ” ” & odest & “\” & fname
wshShell.run “rar ” & “a” & ” ” & “-df” & ” ” & “-p” & passwd & ” ” & “-hp” & passwd & ” ” & “-ep” & ” ” & “-ep1″ & ” ” & ” ” & “-v700000″ & ” ” & ” ” & fdest & “\” & fname & “.rar” & ” ” & odest & “\” & fname
Set wshShell = nothing
End Sub
objLogFile.Close
Advertisements

The Hobbit

Posted: August 18, 2010 in Linux
Tags: , ,

Let’s talk a bit about Hobbit. Well, am not talking about the famous novel of J.R.R Tolkien, but about the Hobbit Monitoring Tool. Hobbit can monitor servers, networks, applications etc…;Just to name a few. More about Hobbit can be found at the Hobbit project page  at http://xymon.sourceforge.net/docs/about.html. I’ve been using Hobbit for quite a few years now to monitors most of equipment in the Company data centers. Some of my Hobbit extensions are on Launchpad at https://code.launchpad.net/hobbit-mon. I will gradually post more extensions when time permits.