Quote:
Originally Posted by V3l0
Hello,
First, when you select "*log*", you don't have to select "*.log*" beacause they are already in the first selection !
Second, why "touching" the file before deleting it ?
Third, your script will be runnig with "unable to remove file xxx" beacause of the command "rm -f $filestodelete" that will delete all the files selected by "for files in (*log*|*.log*)"
So, I propose you the script :
Code:
list=$(ls *log*)
for file in $list
do
cp $file $file.$(date +%a)
rm -f $file
done
|
you gave me good suggestions.Thanks..
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.