Mittwoch, 29. Dezember 2010

Delete specific files

This script was developed to delete files with a specific extension inside a given folder. In this case, installation logs from MS Patch / Hotfix Installations will be deleted. This script can easily be adopted to delete other files also.

DIM fso, f, fc, file
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder("c:\winxp")
Set fc = f.Files
For Each file in fc
  if strcomp(right(file.name,4),".log",1)=0 then
    fso.DeleteFile("c:\winxp\" & file.name)
  end if
Next

Delete specific folders

This script is designed to search and delete temporary folders, which are created by MS Patch / Hotfix Installations. The script can be easily adopted to be used for other folders also. This script will find and delete hidden and system folders also, so be careful when using it.
The script uses the Windows Scripting Host functions.

DIM fso, folder, subflds, fld
Set fso = CreateObject("Scripting.FileSystemObject")
Set folder = fso.GetFolder("c:\winxp")
Set subflds = folder.SubFolders
For Each fld in subflds
  if strcomp(left(fld.name,1),"$",1)=0 then
    fso.DeleteFolder("c:\winxp\" & fld.name)
  end if
Next

Donnerstag, 2. Dezember 2010

Enable TimeMachine for Unsupported Drives

By Default, TimeMachine only supports Network Drives capable of the "afp" protokoll. The problem is, that these drives often are more expensive then regular one's dedicated for use in Windows Networks. MacOS X Supports "smb" protokoll too, but TimeMachine would not accept those drives by default. Following there is a short guide, how to enable that support. You will need the Terminal Console, so open it an continue:

1. Enable use of unsupported drives

defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1

2. Create Sparsebundle File

hdiutil create -size 200G -fs HFS+J -type SPARSEBUNDLE "MACNAME_MAC-adress.sparsebundle"

where:
-size defines Max. space used for Backups
MACNAME is the name of your Mac e.g. iMac
MAC-Adress is the MAC adress of your Ethernet Card

3. Mount Share and copy Sparsebundle File

Now mount the NAS Share to your Mac and copy the sparsebundle file onto.

Take care the share is mounted always and start TimeMachine. Now you're Done.