Skip to content

Instantly share code, notes, and snippets.

@JohnL4
Last active December 20, 2019 20:42
Show Gist options
  • Save JohnL4/db2afbe7ffdaf8ba48fa1b377afeae4f to your computer and use it in GitHub Desktop.
Save JohnL4/db2afbe7ffdaf8ba48fa1b377afeae4f to your computer and use it in GitHub Desktop.
Copy files that don't already exist in a destination directory
ls | ? {(-not (Test-Path (Join-Path c:\tmp\DirB $_.Name)))} | cp -dest c:\tmp\DirB -pass
# Not recursive.
# Test-Path can also do date-checking.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment