I have a powershell script that will search through the sub folders of a directory and copy any files that contain a specific string in the name and then move those into a different folder that it creates. The problem I am having is that the script is not creating and new folder but just a new file without an extension. Here is my script.
Get-ChildItem -Path 'C:\users\user1\Documents\q3\' -Recurse | Where-Object { $_.Name -like "*test2*" -and $_.FullName -notmatch 'newfolder' } | Copy-Item -Destination 'C:\Users\user1\Documents\Q3\test'
if{-not (test-path $folder_path)}(mkdir $folder_path)or similar to the script beginning. test for the path of the folder, make it if it isn't there already, then continue.