PowerShell Get-ChildItem include multiple files

Status
Not open for further replies.

LTParis

Ars Legatus Legionis
23,426
Subscriptor
I wrote a script to purge files from a memory card to a location on my network. However I had no idea they were doing video too. Is there a way to use -Include with multiple file types?

Code:
Get-ChildItem -Path $mydrive -Recurse -Include *.jpg  | Move-Item -Destination $destinationFolderWorking -verbose

UPDATE: Found a fix.

Code:
$IncludeFiles = ("*.jpg","*.avi","*.mpg")
...
Get-ChildItem -Path $mydrive -Recurse -Include $IncludeFiles  | Move-Item -Destination $destinationFolderWorking -verbose
 
Status
Not open for further replies.