|
Answer» 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?
CODE: [Select]$path1 = D:\A $path2 = D:\B $path3 = D:\C $fileList = get-childitem $path1 | ?{$_.name -notin $(get-childitem $path2).name } $filelist.name | copy-item $path3Do you get any error messages? You must provide a value expression on the right-hand side of the '-' operator.
Code: [Select]At D:\copy_files.ps1:4 char:47 + $fileList = get-childitem $path1 | ?{$_.name - <<<< notin $(get-childitem $path2).name } + CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException + FullyQualifiedErrorId : ExpectedValueExpressionHave you Googled what that might mean?
Quote from: Salmon Trout on May 15, 2019, 12:15:30 AM Have you Googled what that might mean?
I did, but I get MANY different RESULTS so don't know what it is
|