Synchronize Files and Folders using Powershell

Hello everyone!

Last week I was helping an Application Admin to Synchronize files and folders between Source and Destination Servers. The challenge was because some folders had really long hierarchies, so you could imagine something like this.

image

I would say that doing this for some files it is really ok, but for my case we are talking about of 10GB of data and around 4K folders in the root level. Basically, this was the solution that I was able to come up.
The script in in the Github link below.

image
Code: https://github.com/marcosfreccia/Powershell-Scripts/blob/master/SyncFileSystem.ps1

For testing purposes, when I ran a small test, that’s something that you could see it.
image

Off course, there are ways to improve the efficiency and the performance of the code, but I just wanted do something simple and where everyone can read it and understand. If you want to improve it, at least you have a starting point.

I hope it helps!

Marcos Freccia
Data Platform MVP

 

 

About Marcos Freccia

MVP em SQL Server (Data Plataform) , especialista em SQL Server, e atualmente trabalhando com Microsoft Azure!

Posted on January 17, 2018, in Comunidade, Dicas, Powershell, Scripts, VirtualPass and tagged , , , , , , , , . Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: