From time to time I need to do bulk file renames on linux and solaris servers. These renames are generally done when I need to run a few apache logs through awstats. We use load balancer for the servers. Every so often the logs are setup with the standard access.log. With a few servers handling the content awstats has a perl script that can be used to combine the logs. So when we dump the logs if we are not renaming the logs we have rename them till the logrotate is updated. Here is the simple script to do that. I run this in bash.
for filename in *; do target=$(echo $filename | sed -e ‘s/access/access-server1/g’); mv $filename $target; done
We also rotate the logs everyday and the date stamp to the file. This allows us to know what days have been run and delete.





































