Powershell delete old log files




















This might need tweaking. Otherwise, the same comments as for the code above apply. Copy text value to clipboard using jQuery Simple sample of using jQuery to copy value to clipboard. Resize image on the client side with JQuery Reducing the upload sie by resizing image on the client side. Getting first and last second of the current year, month and day Using minimum and maximum date time in SQL query. Umbraco CMS 2. Generate sitemap. Same page language switching in Umbraco Land on the same page in different language in Umbraco using Relations.

Getting cropped image the smart way The way to get cropped image URL with option to load original image too. Latest articles.

NET Supporting multiple authentication schemes in asp. NET Adding display name to Enum values. NET C scripting with. Roland Jansen Roland Jansen 2, 1 1 gold badge 13 13 silver badges 19 19 bronze badges. I believe the last -recurse is one too much, no? The dir listing is recursively, the deletion of the item should not be with childs included, right? If the directory you're working with is two directories deep a second -recurse is needed.

Esperento57's script doesn't work in older PowerShell versions. LastwriteTime -lt Get-Date. AddDays -and! I've updated my answer to exclude directories now, thanks. Another alternative Jeff Blumenthal Jeff Blumenthal 2 2 silver badges 8 8 bronze badges. LastwriteTime is not the same as CreationTime , LastwriteTime is update each time the file is modified.

Aigar Aigar 11 1 1 bronze badge. Peter Mortensen Ikruzzz Ikruzzz 1 1 gold badge 3 3 silver badges 15 15 bronze badges. You should place the foreach in the if statement. I'm guessing so- just stumbed across the same script here; networknet.

The Overflow Blog. Stack Gives Back PowerShell is a really good scripting language to automate many things on both Linux and Windows. You can use the following one-liner PowerShell script to delete files that are older than 30 days. Now that you're script is ready, you can create an Azure Web Job under you Azure App Service using the following steps:.



0コメント

  • 1000 / 1000