Snippets

Ettar Powershell Dateien/Verzeichnisse in Unterverzeichnissen löschen

Created by Ettar

File snippet.txt Added

  • Ignore whitespace
  • Hide word diff
+$path = Read-Host "Pfad"
+
+if(!(Test-Path $path)){
+    Write-Host "Pfad $path unbekannt"
+}else{
+    if((Read-Host "Unterverzeichnisse in $path bereinigen (J/N)?") -eq "J"){
+        foreach($folder in (Get-ChildItem $path -Directory)){
+            foreach($file in (Get-ChildItem $folder.FullName)) {
+                Remove-Item $file.FullName
+            }
+        }
+    }else{
+        Write-Host "Skript wird abgebrochen"
+    }
+    
+}
HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.