Update publish-to-ipfs.ps1

This commit is contained in:
Markus Fleschutz 2021-09-11 11:17:17 +02:00 committed by GitHub
parent a5ee42192a
commit 9872ba3b16
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -19,22 +19,20 @@ try {
$StopWatch = [system.diagnostics.stopwatch]::startNew()
""
"Step 1/3: Searching for IPFS executable..."
"Step 1/3: Searching for IPFS..."
& ipfs --version
if ($lastExitCode -ne "0") { throw "Can't execute 'ipfs' - make sure IPFS is installed and available" }
if (test-path "$Files" -pathType container) {
""
"Step 2/3: Publishing folder $Files/ to IPFS..."
[int]$Count = 1
& ipfs add -r "$Files" > $HashList
[int]$Count = 1
""
echo "Step 3/3: Calculating digital forensics hashes to $DF_HASHES ..."
& nice hashdeep -c md5,sha1,sha256 -r -d -l -j 1 "$Files" > $DF_Hashes
} else {
$FileList = (get-childItem "$Files")
[int]$Count = $FileList.Count
foreach ($File in $FileList) {
if (test-path "$Files" -pathType container) {
"Step 2/3: Publishing folder $File/ to IPFS..."
@ -44,6 +42,7 @@ try {
& ipfs add "$File" >> $HashList
}
}
[int]$Count = $FileList.Count
}
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds