well i must be doing something wrong ... lets see :
today_date =$(date +"%Y"_"%m"_"%d") # this returns ex: 2012_11_21
for i in $(ls)
do
if [ $(echo $i | awk -F"From_" ' { print substr($2,1,10) } ' ) eq $today_date]
then
mv $i $today_date
else
echo $i >> not_moved.txt
fi
done
i try to put in the if echo "$i" == "$today_date" i get unary operator
today_date=$(date +"%Y"_"%m"_"%d") # this returns ex: 2012_11_21
for i in * # OR you can use *.zip
do
if [ $( echo "$i" | awk -F"From_" ' { print substr($2,1,10) } ' ) = "$today_date" ]
then
mv "$i" "$today_date"
else
echo "$i" >> not_moved.txt
fi
done