Last active
October 24, 2023 21:19
-
-
Save EndlessTrax/18bc54863350f299cf816b8374d2d3f2 to your computer and use it in GitHub Desktop.
Find all eBooks in a folder, recursively.
This file contains hidden or 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
| [CmdletBinding()] | |
| param ( | |
| [Parameter()] | |
| [string] | |
| $InputFolder, | |
| [Parameter()] | |
| [string] | |
| $OutputFolder | |
| ) | |
| $Formats = @( | |
| "*.epub", | |
| "*.mobi", | |
| "*.azw" | |
| ) | |
| # If a more than one book is found with the same name and format, just in a different folder, it will be | |
| # overwritten so only one copy will remain. | |
| foreach ($Format in $Formats) { | |
| Get-ChildItem -Path $InputFolder -Filter $Format -Recurse | ForEach-Object { | |
| Copy-Item -Path $_.FullName -Destination $OutputFolder | |
| Write-Host "Copied $($_.Name) to $OutputFolder" | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment