-
Notifications
You must be signed in to change notification settings - Fork 220
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #579 from Thayol/add-powershell-scripts
- Loading branch information
Showing
4 changed files
with
74 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Declare files that will always have CRLF line endings on checkout. | ||
*.ps1 text eol=crlf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
if (Test-Path -Path $args[0] -PathType Leaf) { | ||
$file=$args[0] | ||
} | ||
else { | ||
Write-Host "CANNOT FIND LOG FILE" | ||
Exit 1 | ||
} | ||
|
||
if ($args[1] -ne $null) { | ||
$output=$args[1] | ||
Write-Host "Outputting IDs to $output" | ||
} | ||
else { | ||
$output="./failed.txt" | ||
} | ||
|
||
Select-String -Path $file -Pattern "Could not download submission" | ForEach-Object { -split $_.Line | Select-Object -Skip 11 | Select-Object -First 1 } | foreach { $_.substring(0,$_.Length-1) } >> $output | ||
Select-String -Path $file -Pattern "Failed to download resource" | ForEach-Object { -split $_.Line | Select-Object -Skip 14 | Select-Object -First 1 } >> $output | ||
Select-String -Path $file -Pattern "failed to download submission" | ForEach-Object { -split $_.Line | Select-Object -Skip 13 | Select-Object -First 1 } | foreach { $_.substring(0,$_.Length-1) } >> $output | ||
Select-String -Path $file -Pattern "Failed to write file" | ForEach-Object { -split $_.Line | Select-Object -Skip 13 | Select-Object -First 1 } >> $output | ||
Select-String -Path $file -Pattern "skipped due to disabled module" | ForEach-Object { -split $_.Line | Select-Object -Skip 8 | Select-Object -First 1 } >> $output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
if (Test-Path -Path $args[0] -PathType Leaf) { | ||
$file=$args[0] | ||
} | ||
else { | ||
Write-Host "CANNOT FIND LOG FILE" | ||
Exit 1 | ||
} | ||
|
||
if ($args[1] -ne $null) { | ||
$output=$args[1] | ||
Write-Host "Outputting IDs to $output" | ||
} | ||
else { | ||
$output="./successful.txt" | ||
} | ||
|
||
Select-String -Path $file -Pattern "Downloaded submission" | ForEach-Object { -split $_.Line | Select-Object -Last 3 | Select-Object -SkipLast 2 } >> $output | ||
Select-String -Path $file -Pattern "Resource hash" | ForEach-Object { -split $_.Line | Select-Object -Last 3 | Select-Object -SkipLast 2 } >> $output | ||
Select-String -Path $file -Pattern "Download filter" | ForEach-Object { -split $_.Line | Select-Object -Last 4 | Select-Object -SkipLast 3 } >> $output | ||
Select-String -Path $file -Pattern "already exists, continuing" | ForEach-Object { -split $_.Line | Select-Object -Last 4 | Select-Object -SkipLast 3 } >> $output | ||
Select-String -Path $file -Pattern "Hard link made" | ForEach-Object { -split $_.Line | Select-Object -Last 1 } >> $output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
if (Test-Path -Path $args[0] -PathType Leaf) { | ||
$file=$args[0] | ||
} | ||
else { | ||
Write-Host "CANNOT FIND LOG FILE" | ||
Exit 1 | ||
} | ||
|
||
if ($args[1] -ne $null) { | ||
$output=$args[1] | ||
Write-Host "Outputting IDs to $output" | ||
} | ||
else { | ||
$output="./successful.txt" | ||
} | ||
|
||
Write-Host -NoNewline "Downloaded submissions: " | ||
Write-Host (Select-String -Path $file -Pattern "Downloaded submission" -AllMatches).Matches.Count | ||
Write-Host -NoNewline "Failed downloads: " | ||
Write-Host (Select-String -Path $file -Pattern "failed to download submission" -AllMatches).Matches.Count | ||
Write-Host -NoNewline "Files already downloaded: " | ||
Write-Host (Select-String -Path $file -Pattern "already exists, continuing" -AllMatches).Matches.Count | ||
Write-Host -NoNewline "Hard linked submissions: " | ||
Write-Host (Select-String -Path $file -Pattern "Hard link made" -AllMatches).Matches.Count | ||
Write-Host -NoNewline "Excluded submissions: " | ||
Write-Host (Select-String -Path $file -Pattern "in exclusion list" -AllMatches).Matches.Count | ||
Write-Host -NoNewline "Files with existing hash skipped: " | ||
Write-Host (Select-String -Path $file -Pattern "downloaded elsewhere" -AllMatches).Matches.Count | ||
Write-Host -NoNewline "Submissions from excluded subreddits: " | ||
Write-Host (Select-String -Path $file -Pattern "in skip list" -AllMatches).Matches.Count |