I have folder A with files which are compressed and copied to folder B
files in folder A have extension .bak, files in folder B have extension .zip, but both have the same name. (Like first is monday.bak and second is monday.zip)
now I need to copy files from folder A to folder C, but only files which doesn't exist in folder B.
For example folder A have files
monday.bak
tuesday.bak
wednesday.bak
Folder B have files
monday.zip
tuesday.zip
Now I need to copy from folder A to folder C what is missing in folder B
and that is file wednesday.bak
I tried this but not working, what I am doing wrong?
$path1 = D:\A
$path2 = D:\B
$path3 = D:\C
$fileList = get-childitem $path1 | ?{$_.name -notin $(get-childitem $path2).name }
$filelist.name | copy-item $path3