Skip to content

Commit

Permalink
corrected parent-folder inclusion
Browse files Browse the repository at this point in the history
  • Loading branch information
vbhayden committed Feb 5, 2019
1 parent cb39276 commit 18d05b4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 10 deletions.
15 changes: 10 additions & 5 deletions find-in-scorm.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,20 @@ Add-Type -assembly "System.IO.Compression.FileSystem"

Write-Host "`nChecking for SWF files within zipped SCORM modules..."

$folders = Get-ChildItem $path -Recurse -Attributes d | Sort-Object -Property name -Descending
# Filter for every SWF file in the given path, including sub-folders
$allFolders = New-Object System.Collections.Generic.List[System.Object]
$subFolders = Get-ChildItem $path -Recurse -Attributes d | Sort-Object -Property name -Descending

# Check if they only specified one folder
if ($folders.count -eq 0) {
$folder = Get-Item $path
$folders = @($folder)
if (Test-Path $path -PathType Container) {
$current = Get-Item $path
$allFolders.Add($current);
}
ForEach ($sub in $subFolders) {
$allFolders.add($sub)
}

$Result = ForEach($folder in $folders) {
$Result = ForEach($folder in $allFolders) {

# Make sure we only search in the designated folders
if ($folder.FullName -notmatch $filter) {
Expand Down
14 changes: 9 additions & 5 deletions find-swf.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,20 @@ if ($false -eq $path.Contains("*")) {
Write-Host "`nChecking for SWF files ...`n"

# Filter for every SWF file in the given path, including sub-folders
$folders = Get-ChildItem $path -Recurse -Attributes d | Sort-Object -Property name -Descending
$allFolders = New-Object System.Collections.Generic.List[System.Object]
$subFolders = Get-ChildItem $path -Recurse -Attributes d | Sort-Object -Property name -Descending

# Check if they only specified one folder
if ($folders.count -eq 0) {
$folder = Get-Item $path
$folders = @($folder)
if (Test-Path $path -PathType Container) {
$current = Get-Item $path
$allFolders.Add($current);
}
ForEach ($sub in $subFolders) {
$allFolders.add($sub)
}

# Iterate over each SWF file to see if it follows our parent filter
ForEach($folder in $folders) {
ForEach($folder in $allFolders) {

# Make sure we only search in the designated folders
if ($folder.FullName -notmatch $filter) {
Expand Down

0 comments on commit 18d05b4

Please sign in to comment.