Multiple Flash Drive File Sync Windows Batch Script

Posted by on Jul 1, 2017 in How To

Multiple Flash Drive File Sync Windows Batch Script

How to Sync the same Files on Multiple Flash Drives

I own two computer shops with many technicians. We use multiple identical flash drives with common installation programs and technician tools. Everyday we check for and download new installers with Ketarin. It was becoming too time consuming to manually maintain so many flash drives with identical files and daily updates. One day technician Zachary Kahler decided to automate the process with scripting. This windows batch script will synchronize all your flash drives from one common source folder. Any time you add, remove, or update your source folder files, you can then plug in all your flash drives and run this script. It will automatically synchronize the files to all your flash drives. This is a Windows batch script, it runs on windows only. If you don’t already know what a batch file is you might want to skip this project.

INSTRUCTIONS FOR USE

Download the script here 

STEP 1 setup source folder
Prepare a source folder to sync to your flash drives
Add a new folder to you C: drive and put your files in it, this is where you will add, remove, or update your source folder files frequently. Tip: it is easiest when you have a short folder name and file path like C:\MCR_SYNC

STEP 2 setup flash drive folders
Plug in all the flash drives you want to sync files to, I use six flash drives.
note: the files will only sync to a folder, not the root of the flash drive.
YOU MUST manually create the folder on your flash drives before running the script for the first time, do this now.
DO NOT use a common folder name like Documents, photos, my files, etc. for the folder name on the flash drives.
A unique folder name will prevent another drive from having one of it’s folders overwritten. Make sure the flash drives have enough free space to accept the full contents of your source folder.

STEP 3 configure the for command in the script code
To change the drive letter settings and folder names you have to carefully edit the for command line in the script code…

Change F G H I J K in the for command to the actual drive letters of your flash drives, you can add or remove drive letters as needed. Note if the drive letter is not present at run time it will be skipped.
Do not include the drive letter of a current internal hard drive, media slot, or DVD drive.

Change your file path and folder names as needed

Change C:\MCR_SYNC in the for command to the actual folder name and path where your source files are.
Change MCR_Flash_Files in the for command to the actual folder name you created on your flash drives.
Do not modify the %%X because that is a variable in the for loop command.

STEP 4 testing your script
Before use, you must rename the script from FlashDriveSync.txt to FlashDriveSync.bat
MAKE SURE ALL EXTERNAL DRIVES ARE DISCONNECTED
then CONNECT ALL FLASH DRIVES TO BE UPDATED
double click the batch file FlashDriveSync.bat
watch as your flash drives are automatically synced.