I have two folders Folder1 and Folder2 in C drive. Folder1 has few files which needs to be copied to Folder2. Also, after copy of each file from folder1 to folder2, the files can be moved to another folder called ‘Backup’. The point is - this needs to be done by looping each file in the folder. Can you please guide me on this? I am currently using the below script for this, but this gives an error
$CopyFrom = “C:\Folder1”
$CopyTo = “C:\Folder2”
Get-ChildItem -Path $CopyFrom -Exclude ControlFile | ForEach-Object -Process {Copy-Item $File -Destination $CopyTo }