PowerShell Tutorials : Log / File Cleaner (Beginner Project)

preview_player
Показать описание
In this video I will go over how to create a automated log/file cleaner, that you can use to keep your log folders clean or even the downloads folder clean as well.

Tags:
PowerShell
Email
Programming
Scripting
Automating
JackedProgrammer
Coding
Рекомендации по теме
Комментарии
Автор

Thanks Jacked, this has been really useful and informative for me! Cheers

mumk
Автор

Hello @JackedProgrammer I want to actually create a log file for all the deleted files, Could u please help me with that.

krishnachavan
Автор

I follow your code but I'm not able to delete the files. I have two folders with files in them. All those files were created in July 2022

CSV file
DirectoryPath, KeepForDays
C:\DownloadFolder, 10
C:\DownloadFolder2, 30

PS1 file
$DirectoryListFilePath =
$DirectoryList = Import-Csv -Path $DirectoryListFilePath

foreach($Directory in $DirectoryList){

Get-ChildItem -Path $Directory.$DirectoryPath `
| Where-Object LastWriteTime -lt `
| Remove-Item -Confirm:$false -Force
}

lot
visit shbcf.ru