Opengist

Explore

  • All gists
  • Topics
  • Users
Give feedback on the new UI Powered by Opengist ⋅ 40ms

user:thomas gists created by user

title:mygist gists with given title

description:sync gists with given description

filename:myfile.txt gists having files with given name

extension:yml gists having files with given extension

language:go gists having files with given language

topic:homelab gists with given topic

all:systemctl search all fields

Login
P

PowerShell

Recently created Least recently created Recently updated Least recently updated
michelgentile

michelgentile / Housekeep folder

Last active 6 months ago PowerShell
0 0 1
1 #Remove files older than...
2 Get-ChildItem -File -Recurse | Where-Object { $_.LastWriteTime -lt (Get-Date).AddDays(-180) } | Remove-Item -Force
3
4 #Remove empty folders (may be repeated up to X times...)
5 Get-ChildItem -Directory -Recurse | Where-Object { -not (Get-ChildItem -Path $_.FullName -Recurse -Force -ErrorAction SilentlyContinue) } | Remove-Item -Force
michelgentile

michelgentile / Symbolic Link in Windows

Last active 6 months ago PowerShell
0 0 1
1 pwsh -command "New-Item -ItemType SymbolicLink -Target 'c:\i\am\the\classic\folder' -Path 'c:\this\is\a\symbolic\link'"
michelgentile

michelgentile / Compute Hash with PowerShell

Last active 6 months ago PowerShell
0 0 1
1 pwsh -command "( Get-FileHash -Algorithm SHA256 c:\folder\file ).Hash.ToLower()"