I want to use a Powershell script for copy a folder recursive to a other position. This must the Powershell todo:
- copy file and folders from position A to position B
- UNC PAth must have (for example \net.local\Files\EDV)
- On position B must all empty Folder clear
- The structure of position B must equals with postion A
- Missing folders should be created on B .
- It should only copy files that are older than 180 days
- The Script must create a logfile with Information about the filename and path, File size, file date
I have begun with this script:
$a = '\\serverA\folderA'
$b = '\\serverB\folderB'
#This copies the files
Get-ChildItem $a -Recurse -File | Foreach_Object {Copy-Item $_ -Destination $b}
#Removes empty files
Get-ChildItem $b -File | Foreach-Object {IF($_.Length -eq 0) {Remove-Item $_}}
I need help..