I want to get table like name-algorithm-hash for files, ended by .gz in folder
a filtration work well:
powershell -command " Get-ChildItem -Filter 'L04\*.gz' | Select Name"
give a table:
Name
v300040828_run20_L04_62_1.fq.gz
v300040828_run20_L04_62_2.fq.gz
But upgreid command with hash powershell -command " Get-ChildItem -Filter 'L04\*.gz' | ls | Get-FileHash -Algorithm MD5| Select Name,Algorithm,Hash"
give me only alg and hash without name..
Name Algorithm Hash
MD5 08B622CFAB1254DE77DEE2B86B8566C5
MD5 BB0ACF3AE1F9E67BAF8F64736221D401
Help me please to get also name
Get-FileHash returns an object with properties Path
, Algorithm
and Hash
.
Path being the file's FullName.
If you want that changed, you can do
Select-Object @{Name = 'Name'; Expression = {[System.IO.Path]::GetFileName($_.Path)}}, Algorithm, Hash