I'm trying to create a for loop to delete log files older than 15 days. Below is my script:
#!/bin/sh
path="/home/test"
logpath="$path/logs"
for logfile in `find $logpath -mtime +14 -type f -name *.log`
do
echo "Deleting Log File: " $logfile
rm -rf $logfile
done
It keeps throwing an error:
find: paths must precede expression
Usage: find [-H] [-L] [-P] [path...] [expression]
Any ideas?
*.logwithin double-quotes like"*.log"