PowerShell: Synchronizing a Folder (and Sub-Folders) Part 9

Hi. Here’s another update on the Sync-Folder script. The script itself is at that link but in this post I go over the changes I made and how they work.

The main addition is the support for -WhatIf (so you can test the script runs without it making changes).  In addition I fixed some odd bugs with the Filter and Exceptions parameters.  Plus some more Verbose logging and I tidied up the script a bit (removing some of the cmdlet aliases and replacing them with the full commands). Continue reading “PowerShell: Synchronizing a Folder (and Sub-Folders) Part 9”

PowerShell: Synchronizing a Folder (and Sub-Folders) Part 7

Hi. Here’s another update on the Sync-Folder script.  In this update Strict mode goes on, I make sure the statistics reset between runs, the Statistics output is rewritten and I add the option to only sync items that match a $Filter.

Update : I’ve revisited this script a few times with new additions and modifications.The latest full version of the script is here.  That post also includes links covering the other revisions to the script. Continue reading “PowerShell: Synchronizing a Folder (and Sub-Folders) Part 7”

PowerShell: Synchronizing a Folder (and Sub-Folders) Part 6

Hi. Here’s another update on the Sync-Folder script here.  In this part I add some more code to use literal paths (so that special characters don’t cause the sync to fail) and a report of the numbers of copies, updates, folder removals etc performed.

Update : I’ve revisited this script a few times with new additions and modifications.The latest full version of the script is here.  That post also includes links covering the other revisions to the script. Continue reading “PowerShell: Synchronizing a Folder (and Sub-Folders) Part 6”

PowerShell: Synchronizing a Folder (and Sub-Folders) Part 5

I’ve made some more changes to the syncing script. The first was some corrections about how it deals with paths with ‘odd’ symbols in them (like “[“) and the second was to properly output objects listing all the changes its made (for logging or further processing).

Update : I’ve revisited this script a few times with new additions and modifications.The latest full version of the script is here.  That post also includes links covering the other revisions to the script.

Continue reading “PowerShell: Synchronizing a Folder (and Sub-Folders) Part 5”

PowerShell: Synchronizing a Folder (and Sub-Folders) Part 4

Some more additions to the script.  In this part I add some additional configuration options, parameter validation and some error-checking.

Update : I’ve revisited this script a few times with new additions and modifications.The latest full version of the script is here.  That post also includes links covering the other revisions to the script.

Continue reading “PowerShell: Synchronizing a Folder (and Sub-Folders) Part 4”

PowerShell: Synchronizing a Folder (and Sub-Folders) Part 3

I’ve used the Sync-Folder script quite a bit and I thought it might be time to revisit it, clean it up and add some more functionality.

Here’s what I’m adding in this first part;

  1. Load all the configuration from an XML file.  Useful to allow more complex configurations and a lot easier to edit that parameters or local variables.
  2. Proper documentation (so that Get-Help returns useful information).
  3. Allow multiple Source / Target pairs instead of just the one source folder.   Multiple copies of the same source is good for extra safe backups.

The script and explanation follows after the line.

Update : I’ve revisited this script a few times with new additions and modifications.The latest full version of the script is here.  That post also includes links covering the other revisions to the script.

Continue reading “PowerShell: Synchronizing a Folder (and Sub-Folders) Part 3”