ich habe es mit Powershell umgesetzt auch mithilfe KI (copilot) und schon die bekannten dateiformate eingesetzt (Achtung beim Drive C: und evtl. einer Cloudanbindung es werden auch die cloudverzeichnisse dursucht und mit kopiert): einfach als DATEINAME.ps1 abspeichern in notepad und nicht als .txt-format.
das ausführen von powershell scripten ist standardmäßig deaktiviert:
Powershell als admin ausführen und folgendes eingeben
Eingabe:
PS C:\WINDOWS\system32> Set-ExecutionPolicy -ExecutionPolicy RemoteSigned
Ausgabe:
Execution Policy Change
The execution policy helps protect you from scripts that you do not trust. Changing the execution policy might expose
you to the security risks described in the about_Execution_Policies help topic at
https:/go.microsoft.com/fwlink/?LinkID=135170. Do you want to change the execution policy?
[Y] Yes [A] Yes to All [N] No [L] No to All Suspend [?] Help (default is "N"): A
Mit A bestätigen später wieder rückgängig mit:
Set-ExecutionPolicy -ExecutionPolicy Restricted -Scope LocalMachine
code:
# Define the extensions you want to search for
$extensions = @(".jpg", ".jpeg", ".png", ".gif", ".bmp", ".tiff", ".webp", ".heic",
".mp4", ".mov", ".avi", ".mkv", ".flv", ".wmv", ".webm", ".3gp")
# Output CSV path
$outputCsv = "$env:USERPROFILE\Desktop\FileExtensionsReport.csv"
# Initialize an empty array to store results
$results = @()
# Search entire C: drive Change driveletter that corresponds to your harddisk
foreach ($ext in $extensions) {
$files = Get-ChildItem -Path C:\ -Recurse -Include $ext -ErrorAction SilentlyContinue
foreach ($file in $files) {
$results += [PSCustomObject]@{
Name = $file.Name
Extension = $file.Extension
FullPath = $file.FullName
SizeMB = [math]::Round($file.Length / 1MB, 2)
LastWrite = $file.LastWriteTime
}
}
}
# Export to CSV
$results | Export-Csv -Path $outputCsv -NoTypeInformation -Encoding UTF8
Write-Host "Report saved to $outputCsv"
EOF