Sync Files


  1. Posts : 1
    Windows 10
       #1

    Sync Files


    Hi

    I have two hard drives where I store files.

    Hard Drive 1 - Main Storage
    Hard Drive 2 - Secondary Storage

    I deleted a lot of redundant files from drive one. Now I want the second drive to have the same files deleted.

    There are thousands and thousands of files. Is there a way to sync without going through each file individually?

    Thanks.
      My Computer


  2. Posts : 4,551
    Windows 11 Pro 64-bit
       #2

    This batch script just copies the new files and changed files.


    Code:
    @echo off
    :: Incremental_Backup.bat Created by Hackoo on 12/08/2017
    :: It is a total copy first and then incrementally,
    :: ie, it just copies the new files and changed files.
    mode con cols=95 lines=5 & color 0E
    Title %~nx0 for Incremental Backup with XCopy Command by Hackoo 2017
    set "Settings=%~dp0Settings.ini"
    Set "FirstFull_CopyLog=%~dp0%~n0_FirstFull_CopyLog.txt"
    Set "LogFile=%~dp0%~n0_Incremental_CopyLog.txt"
    If not exist "%Settings%" (
    	Call :BrowseForFolder "Please choose the source folder for the backup" SourceFolder
    	Setlocal EnableDelayedExpansion
    	If defined SourceFolder (
    		echo(
    		echo             You chose "!SourceFolder!" as source folder
    	) else (
    		echo(
    		Color 0C & echo                    The source folder is not defined ... Exiting ......
    		Timeout /T 2 /nobreak>nul & exit
    	)
    	Call :BrowseForFolder "Please choose the target folder for the backup" TargetFolder
    	If defined TargetFolder (
    		echo(
    		echo             You chose "!TargetFolder!" as Target folder
    	) else (
    		echo(
    		Color 0C & echo                    The Target folder is not defined ... Exiting ......
    		Timeout /T 2 /nobreak>nul & exit
    	)
    Timeout /T 3 /nobreak>nul
    	(
    		echo "!SourceFolder!" 
    		echo "!TargetFolder!\Backups_%ComputerName%\" 
    	)
    cls & echo( & echo(
    echo         Please wait a while ... The Backup to "!TargetFolder!" is in progress... 
    Call :Backup_XCopy "!SourceFolder!" "!TargetFolder!" "!FirstFull_CopyLog!"
    Timeout /T 1 /nobreak>nul 
    Start "" "!FirstFull_CopyLog!" & exit
    ) else (
    Setlocal EnableDelayedExpansion
    for /f "delims=" %%a in ('Type "%Settings%"') do (
    	set /a idx+=1
    	set Param[!idx!]=%%a
    )
    
    Set "SourceFolder=!Param[1]!"
    Set "TargetFolder=!Param[2]!"
    echo(
    echo        The source Folder from Settings.ini is : !SourceFolder!
    echo        The Target Folder from Settings.ini is : !TargetFolder!
    Timeout /T 1 /nobreak>nul & cls & echo( & echo(
    echo       Please wait a while ... The Backup to !TargetFolder! is in progress... 
    Call :Backup_XCopy !SourceFolder! !TargetFolder! !LogFile!
    )
    Timeout /T 1 /nobreak>nul 
    Start "" !LogFile! & exit
    ::****************************************************************************
    :BrowseForFolder
    set "psCommand="(new-object -COM 'Shell.Application')^
    .BrowseForFolder(0,'%1',0,0).self.path""
    for /f "usebackq delims=" %%I in (`powershell %psCommand%`) do set "%2=%%I"
    exit /b
    ::****************************************************************************
    :Backup_XCopy <Source> <Target> <LogFile>
    Xcopy /c  /d  /e  /s  /i  /y %1 %2 > %3 2>&1
    Exit /b
    ::****************************************************************************
      My Computer


  3. Posts : 2,487
    Windows 10 Home, 64-bit
       #3

    There are a number of applications that will do that. Some are free.

    I use SyncBackFree and previously used FreeFileSync.

    Any of these programs will give you a lot of control about what folders and file extensions are to be included or excluded, as well as the destination. You can schedule or run manually. Sounds like you want hard drive B to be a 100% match of drive A. That's normally called "mirroring", but there are other options as well.
      My Computer


  4. Posts : 6,973
    windows 10
       #4

    Its simpler to use buit in robocopy /mirror option its built by MS for just that
      My Computer


  5. Posts : 56,110
    Multi-boot Windows 10/11 - RTM, RP, Beta, and Insider
       #5

    Samuria said:
    Its simpler to use buit in robocopy /mirror option its built by MS for just that
    Not 100% sure, but I think MS's Sync Toy uses Robocopy under the hood, and has the options needed as stated.

    Hasn't been reworked in long time, but still performs perfectly. I use it every night to sync user files to an external.

    https://www.microsoft.com/en-us/down....aspx?id=15155
      My Computers


  6. Posts : 6,973
    windows 10
       #6

    You can now get a GUI for robocopy to make it simpler Robocopy in Windows 10 & Microsoft Robocopy GUI
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd
All times are GMT -5. The time now is 12:56.
Find Us




Windows 10 Forums