Wednesday, July 11, 2007

File moving shell script according to unix time stamp

change the variables given inside comments. TimeValue should be in HH:MM:SS time format

#!/bin/bash
#+++++++++++++++++++++++++++++++++++++++++++++++++++++
#++++++++Variables++++++++++++++++++++++++++++++++++++
Source=/home/nipuna/first/
Destination=/home/nipuna/second/
TimeValue=00:05:00
#+++++++++++++++++++++++++++++++++++++++++++++++++++++
#Getting date to variable
CheckTime=`date cut -d" " -f4`
#Split Time Value
tHour=`echo $TimeValue cut -f1 -d:`
tMin=`echo $TimeValue cut -f2 -d:`
tSec=`echo $TimeValue cut -f3 -d:`
#Split Date Value
cHour=`echo $CheckTime cut -f1 -d:`
cMin=`echo $CheckTime cut -f2 -d:`
cSec=`echo $CheckTime cut -f3 -d:`
#Sub. by TimeValue
cHour=`expr $cHour - $tHour`
cMin=`expr $cMin - $tMin`
cSec=`expr $cSec - $tSec`
#echo $cHour "." $cMin "." $cSec
#getting file list with time
File_List=`ls --full-time --time-style=full-iso -t $Source awk '{print $7 "%" $9}'`
for i in $File_List;
do
if [ '%' != $i ]; then #remove bulk values
#split file time values
fHour=`echo $i cut -f1 -d:`
fMin=`echo $i cut -f2 -d:`
fSec=`echo $i cut -f3 -d: cut -f1 -d.`
if [ $cHour -gt 0 ]; then
tHour=`expr $fHour - $cHour`
tMin=`expr $fMin - $cMin`
tSec=`expr $fSec - $cSec`
else
tHour=`expr $cHour - $fHour`
tMin=`expr $cMin - $fMin`
tSec=`expr $cSec - $fSec`
fi
if [ $tHour -lt 0 ]; then
fileName=`echo $i cut -f2 -d%`
mv $Source/$fileName $Destination
echo "$fileName moved"
fi
fi
done

Tuesday, July 10, 2007

Good Bye CeIT
Last wednesday(5th) I was leaved from ITC of UOP permanently because I got a job from h'Senid mobile software company as an Imlementation Engineer.

ITC is a good place to work and study. Mainly I could done so meny experiments under UNIX environment.It was a funny times which I had in my life. When I was there I could learned about people and friends and their characteristics.

Tuesday, July 03, 2007

Home Business through Internet
Do you have heard about home businesses via internet? One of my friend was done it nicely so you can visit there.

www.homebizpal.com