Log cleanup automation
📖 Scenario: You are managing a server that generates many log files daily. To save disk space, you want to automatically delete old log files that are no longer needed.
🎯 Goal: Create a PowerShell script that deletes log files older than a certain number of days from a specific folder.
📋 What You'll Learn
Create a variable with a list of log files in a folder
Create a variable for the age limit in days
Use a loop to find and delete files older than the age limit
Print the names of deleted files
💡 Why This Matters
🌍 Real World
Automating log cleanup helps keep servers running smoothly by freeing disk space and reducing manual work.
💼 Career
System administrators and DevOps engineers often write scripts like this to maintain healthy server environments.
Progress0 / 4 steps