I am trying to compile a list of missing files between two folder/directories which have text/image files with the same basename.
# file directory/folder with .txt files
$filesPathText = "C:\test\test3"
# file directory/folder with .JPG files
$filesPathImage = "C:\test\test4"
Content:
Copy of 0002.txt
Copy of 0003.txt
Copy of 0004.txt
Copy of 0006.txt
Copy of 0002.jpg
Copy of 0003.jpg
Copy of 0004.jpg
Copy of 0005.jpg
Copy of 0006.jpg
I want to output that the 'missing' file is: Copy of 0005.txt
I have tried this kind of thing:
$texts = Get-ChildItem -Path $filesPathText
$images = Get-ChildItem -Path $filesPathImage
$result = $images | Where-Object{$texts -notcontains $images}
$result
To me the logic reads correctly but the result is an output of all the image files.
Even though this is a simple example and would seem common usage I have not been able to find a similar question that has been answered.
Any suggestions would be welcome.