updatedb script for Cygwin

#!/bin/bash

updatedb --prunepaths='
/proc /cygdrive/c/program_disk/cygwin
/cygdrive/c/Documents.and.Settings/[^/]*/Local.Settings/Temp
/cygdrive/c/Program.Files
/cygdrive/c/ProgramData
/cygdrive/c/Windows
/cygdrive/[^/]*/System.Volume.Information
/cygdrive/c/$Recycle.Bin
/home/hongyu.zhang/dumpster
'
‚Äč

A safe program to replace unix command ‘rm’

#!/usr/bin/perl -w

## A safer program to replace unix command "rm"
## Author: Hongyu Zhang

if($#ARGV < 0) {
    die("Usage:  $0 filename\n");
}

$dir = `echo ~/dumpster`;
chomp $dir;
mkdir $dir unless(-d $dir);

for($i=0; $i<=$#ARGV; $i++) {
    croak("Directory $ARGV[$i] not existed") unless(-e $ARGV[$i]);
    my @arr = split /\//, $ARGV[$i];
    if(-e "$dir/$arr[$#arr]") {
        $command = "rm -rf $dir/$arr[$#arr]";
        system("$command");
        croak("error running command: $command") if($?);
    }

    $command = "mv -fv $ARGV[$i] $dir";
    system("$command");
    croak("error running command: $command") if($?);
}