Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 8583

Issues with copy/move script

$
0
0

Help would be appreciated.  I am trying to have a script that will copy to multiple locations, then move.  This script will be run every 5 minutes on multiple servers.  The script I wrote (I know is ugly and wrong), works, but it is dropping files.  When I compare the destination locations, files are missing on some of the locations.

Thank you

Here is what I am running now:

 

 

$src = "c:\logs"

$dst1 = "c:\logs-copy"

$dst2 = "\\server1\logshare"

$dst3 = "\\server2\reprocess"

$dst4 = "\\server3\i$\logs\ToBeArchived"

 

Get-ChildItem $src -Filter "*.bin.gz" | Copy-Item -Destination $dst3 -Force -errorAction SilentlyContinue

Get-ChildItem $src -Filter "*.bin.gz" | Copy-Item -Destination $dst4 -Recurse -Force -errorAction SilentlyContinue

Get-ChildItem $src -Filter "*interaction*.bin.gz" | Move-Item -Destination $dst2 -Force -errorAction SilentlyContinue

Get-ChildItem $src -Filter "*.bin.gz" | Move-Item -Destination $dst1 -Force -errorAction SilentlyContinue


Viewing all articles
Browse latest Browse all 8583

Trending Articles