Can you help me to find what is wrong in my powershell function ?
If I execute this request :
I get this result :
I'm trying to do a function that do the same. Actually, my function is :
The result of this after execution is ... no result :
Can you help me to find what is wrong ?
Change line 3 to say:
You're getting no results because there's no files with extension .jpg*.bmp
If you look at the -Include parameter using Get-Help Get-ChildItem -Full, you will see that it is expecting an arrary -Include ‹string›
When you ran the below for the -Include you passed in an array with 2 string element
Get-ChildItem -Recurse -Path C:\tests_onedrive\travail -Include *.bmp,*.jpg | Select-Object DirectoryName -Unique
However here you are creating a single string $FileType="*.jpg,*.bmp", and Get-ChildItem correctly finds no files with "*.jpg,*.bmp" in the path.
You should correct your variable to have an array and each element include your include pattern string.
You must be logged in to reply to this topic.