#!/bin/sh# List all the files with the current date in given directorylatestFiles(){target=$1myvar=`date "+%h %d"`for file in `ls -al $target | grep "$myvar" | grep ':' | sed 's/[-drwx]* *[0-9] *[a-zA-Z0-9]* *[a-zA-Z0-9]* *[0-9]* *[a-zA-Z]* [0-9]* *[0-9]*:[0-9]* *\.*//'`; docmd="`echo cp $file $localFile` `echo $file | sed 's/\//_/g'`"echo $cmd`$cmd`done}# Using Bladelogic NSH locationslatestFiles //servername/users/user1/tomcat/log/*.log