Are you tired of manually copying files between two folders in Windows? In this article, we provide a simple and efficient solution for automatically syncing files between two folders using a batch file and a scheduled task. Learn how to use the built-in xcopy command and automate the process for seamless file updates. Say goodbye to manual file copying and keep your files in sync effortlessly with this easy-to-follow guide

Syncing files between two folders in Windows can be a tedious task if done manually. Fortunately, there are several tools available that can automate the process for us. In this article, we will show you how to sync files between two folders in Windows using the command line and a scheduled task.

Step 1: Create a batch file

The first step is to create a batch file that will contain the command to sync the files. Open a text editor such as Notepad and create a new file. In the file, type the following command, replacing the “Source_folder” and “Destination_folder” with the actual paths of the folders you want to sync:

Copy code


xcopy "Source_folder" "Destination_folder" /E /C /Y /I

This command uses the xcopy command which is a built-in Windows command for copying files and folders. The options used in the command are:

/E : copies all subfolders, including empty ones.
/C : continues copying even if errors occur.
/Y : overwrites existing files without prompting.
/I : assumes that the destination is a folder if it does not exist.
Save the file with a .bat extension, for example “Sync_folders.bat”

Step 2: Create a scheduled task

Create a scheduled task: Open the Task Scheduler by searching for it in the Start menu or by typing “taskschd.msc” in the Run dialog box.

Create a new task: Click on the “Create Basic Task” button on the right side of the window. Give the task a name and a description, then click on Next.

Set the trigger: Choose how often you want the task to run, for example, every day or every week, then click on Next.

Set the action: Choose “Start a program” as the action, then click on Next.

Choose the program to run: In the Program/script field, type the path to the batch file you created in step 1. For example, “C:\Sync_folders.bat” and click on Next.

Finish the task: Click on Finish to create the task.