Skip to content

Instantly share code, notes, and snippets.

View citron's full-sized avatar
🎯
Focusing

William Gacquer citron

🎯
Focusing
View GitHub Profile
@citron
citron / wg_analyze_drive.ps1
Created September 19, 2024 22:36
wg_analyze_drive.ps1
<#
.SYNOPSIS
Ce script PowerShell analyse un lecteur donné et génère un fichier contenant la liste des fichiers et leurs hachages SHA256.
.DESCRIPTION
Ce script prend le nom d'un lecteur en tant qu'argument et parcourt tous les fichiers du lecteur, y compris les fichiers et dossiers cachés. Il calcule le hachage SHA256 de chaque fichier et enregistre les informations dans un fichier nommé "analyse_<DriveName>.list".
.PARAMETER DriveName
Le nom du lecteur à analyser.
@citron
citron / better_than_find_and_stat.ps1
Last active September 18, 2024 05:56
Powershell script to list files in current folder and subfolders, with some or all details + sha256 checksum. Works on Windows and Linux.
Get-ChildItem -Path . -Recurse -File | ForEach-Object {
$hash = Get-FileHash -Path $_.FullName -Algorithm SHA256
$_ | Select-Object -Property FullName, CreationTime, LastWriteTime, LastAccessTime, Length, @{Name="SHA256"; Expression={$hash.Hash}}
}
Get-ChildItem -Path . -Recurse -File | ForEach-Object {
$hash = Get-FileHash -Path $_.FullName -Algorithm SHA256
$_ | Select-Object -Property *, @{Name="SHA256"; Expression={$hash.Hash}}
} | Format-List > analyse.list