i have case with this:
i have file 20110601.txt so i want to auto rename this file like this 20110601_20110602.txt
actual this rename will create if 20110601 came in date 20110602(date from system unix)
so this will be using
#!/bin/bash
folder='/home'
desti='/home/desti'
now= $( date "+%Y%m%d")
if $folder/yyyymmdd=$now
then
cat >$desti/$nows.txt
else
cat >$desti/yyyymmdd_yyyymmdd(date_now).txt
fi
whats should i do for this??
and how i can rename if file like bdg.2011062915666.485.txt tobe 20110629.txt
yesterday_date=`date -d "1 day ago" +%Y%m%d`
today_date=`date +%Y%m%d`
for i in *$yesterday_date.txt
do
name=`basename $i .txt`
cp $i /home/desti/$name_$today_date.txt
done