Monday 23 January 2012

get files count and list from all sub directories

#!/bin/bash

DIRS=$(find "$1" -type d)

for d in $DIRS
do
   [ "$d" != "." -a "$d" != ".." ] && echo -e "$d $(ls $d | wc -l)\n$(ls $d)" || :
done

Saturday 7 January 2012

Untar all files in a single directory

---- List all tgz files and untar them and put into specified single directory

for file in `ls -1 mig_proxy.cdr.06_JAN_2012.*`;do tar zxvf $file -C temp/ ; done

 Here temp is where the extracted files will be placed ..