Quote:
Originally Posted by namishtiwari
Code:
list=$(ls *log*)
for file in $list
do
cp $file $file.$(date +%a)
rm -f $file
done
i have to touch the file because we have some processes running that need to pick that blank file otherwise we need to restart the aaplication again if i deleted the file without touching it.cp will unnecessarily increase the size.
|
What about moving the file and touching a new one:
Code:
for file in `ls *log*`
do
mv $file $file.`date +%a` && touch $file || echo "Can not backup $file";
done