Skip to content

Instantly share code, notes, and snippets.

View NithishKolli's full-sized avatar

Nithish NithishKolli

View GitHub Profile
@magnetikonline
magnetikonline / README.md
Last active September 12, 2018 20:48
PowerShell example to copy local files recursively to target server share with orphan cleanup.

PowerShell copy local files recursively to target server

A PowerShell script which provides the following:

  • Mount remote/target server share with given username/password credentials.
  • Copy all $SourcePath files to target share ($TargetServer / $TargetShare) recursively.
  • Finally, clean up all orphaned directories/files from target share.

Usage example

./remotecopy.ps1 `
	-SourcePath "." `