Skip to content

Instantly share code, notes, and snippets.

@hamsterbacke23
Last active April 13, 2016 13:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hamsterbacke23/f7494fdb15aa1d1fd12a584bb7004da9 to your computer and use it in GitHub Desktop.
Save hamsterbacke23/f7494fdb15aa1d1fd12a584bb7004da9 to your computer and use it in GitHub Desktop.
copypaste.ps1
# Define source and target folders
$source = 'U:\Fromfolder'
$dest = 'Q:\TargetFolder'
# Exclude folders and file types here
$excludeDirs = @('\exclude me please folder')
$excludeFileString = '*.DS_Store Thumbs.db'
$excludeDirString = '';
for ($i=0; $i -lt $excludeDirs.length; $i++) {
$excludeDirString = $excludeDirString + ' "' + $source + $excludeDirs[$i] + '" '
}
$cmdString = '"' + $source + '" "' + $dest + '"' + ' /XD ' + $excludeDirString + ' /XF ' + $excludeFileString + ' /IS /COPY:D'
Write-Host $cmdString;
robocopy $cmdString;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment