Sunday, July 10, 2005

"speed up ur work" script

#!/bin/bash
#
# kmgActionScript
# author: Karan (karanmg@gmail.com)
##########################################
# Sometimes you need to execute an operation on a large no. of files
# and/or directories which are not necessarily in the same dir.
# It can get especially cumbersome, if these files/dirs are hidden.
#
# This script will perform the specified op (cmd) on all the files/dirs
# listed in a file specified by inputFile.
#
# Eg.
# $> find ./ -name .svn > todel
# $> ./kmgActionScript
##########################################

cmd="rm -Rf"
inputFile="todel"

i="1"

cat $inputFile | \
while read line
do
echo "$i: $cmd $line"
i=`expr $i + 1`

$cmd $line
done

Powered by Blogger