As administrators, we do not often use arithmetic operations, such as the sin, cos, log, and exp operations. However, it is possible to do all of them on PowerShell, since PowerShell can leverage .NET. In general, we may use these operations as administrators: Abs (as in absolute), Ceiling, Floor, Round, and Truncate. In this recipe, we will use three of these methods, based on the scenario we have. Use of the other methods is very similar.
Here is the scenario. You have an application that creates logs throughout the day. These logs consume a lot of space. You would like to clean up logs that are between 30 and 31 days old. You are not allowed to use a dual condition for comparison.
Create a function that looks for files that are 30 days old. Your script should also say how much of the log space was cleared, rounded off to the nearest megabyte...