How to Merge Folders and Files in Windows 10 and 11


Folder merging in Windows is an excellent file management idea to organize folders with similar files into one big folder. This helps avoid clutter and offers everything in one place, thus making it easier to find what you are looking for.

That said, by default, Windows has no option to merge folders. Even though it is clever enough to identify multiple folders of the identical name at the same level, there are more efficient ways to merge folders and files in Windows 10 and 11.

Here we show you the best ways to merge folders on a Windows 10 and 11 system. It includes the convenient File Explorer merge option, a PowerShell script hack and third-party tools to merge folders.

1. Merge Folders Using File Explorer

confirm folder replace merge folder file explorer

File Explorer will detect and prompt you to merge the folder when you try to move a folder with a name identical to an existing folder at the same level.

For example, if you have an XYZ folder in D:\Folders and want to merge the XYX folder in the same level, all you have to do is rename the XYX folder as XYZ. When the Confirm Folder Replace prompt appears, click Yes.

Similarly, you can cut and paste the folder with identical names and then opt for the merge option. File Explorer will merge the folders and move the contents to the destination folder. If a duplicate file exists, you can opt for the Replace or Skip option.

Conversely, this can be a time-consuming process when you have to work with hundreds of folders at a time. A more efficient way to overcome this limitation is to use a PowerShell script hack to merge folders on Windows.

2. Merge Folders Using a PowerShell Script

PowerShell is a powerful automation shell utility. You can learn the essential PowerShell cmdlets to automate everyday tasks with a script.

Similarly, you can use a PowerShell script to merge folders in Windows 10 and 11. This is a handy way to merge multiple folders without copying and pasting them one by one.

To use the script, you must enable running scripts in Windows PowerShell. Once done, you can copy and paste the script directly onto the PowerShell window without having to run it as a .ps1 file.

To allow the local PowerShell script to Run, you’ll need to change the execution policy in the Settings app. Here’s how to do it.

enable powershell to run local scripts

  1. Press Win + I to open the Settings app.
  2. Next, open the Privacy & security tab in the left pane.
  3. Click on For Developer under the Security section.
  4. Next, scroll down and click to expand the PowerShell section.
  5. Toggle the switch to turn on Change execution policy to allow local PowerShell scripts to run without signing. Require signing for remote scripts.

With the script running on PowerShell enabled, follow these to execute a PowerShell script to merge folders.

merge folders powershell

  1. Press the Win key and type powershell.
  2. Click on Windows PowerShell from the search results.
  3. Copy and paste the following script in the PowerShell window:
      $sourcePath = "F:\New folder"
    $destinationPath = "E:\New folder"
    $files = Get-ChildItem -Path $sourcePath -Recurse -Filter "*.*"
    foreach($file in $files){
        $sourcePathFile = $file.FullName
        $destinationPathFile = $file.FullName.Replace($sourcePath, $destinationPath)
        $exists = Test-Path $destinationPathFile
            $dir = Split-Path -parent $destinationPathFile
            if (!(Test-Path($dir))) { New-Item -ItemType directory -Path $dir }
            Copy-Item -Path $sourcePathFile -Destination $destinationPathFile -Recurse -Force
            $isFile = Test-Path -Path $destinationPathFile -PathType Leaf
                Copy-Item -Path $sourcePathFile -Destination $destinationPathFile -Recurse -Force
  4. In the above command, replace “E:\New folder” and “F:\New folder” with the source and destination file paths, respectively. To find the file path, right-click on the folder name you want to merge and select Copy as the path.
  5. The above command will merge the contents of the E:\New folder with the F:\New folder. It will skip any duplicate file conflict to leave the original files in the destination folder unaffected.

You can repeat the script with different file paths to merge more folders. If you encounter any error, check if the file path for the destination and source is correct.

2. Merge Folders Using Third-Party Software

If you prefer a GUI-based utility over a PowerShell script to merge files, you have a few options to choose from. Third-party merge tools for Windows offer basic merging capabilities and premium offerings catered to software and creative design professionals.

1. Folder Merger

folder merger windows

Folder Merger is a free utility to merge the contents of different folders into a single folder. You can add multiple source folders to the app and then merge them to a specified destination folder.

Using Folder Merger is easy. You can add a single folder or select a root folder to add first-level subfolders. Next, click the Destination folder icon to set the destination folder.

Once all the folders are added, click Select All to merge all the folders or individual folders using the Ctrl key. Click the Merge button to begin the merging process. Once done, click the Show folder icon in the Destination section to view your newly merged files.

In addition, you can also choose to copy or move the files, merge files of a specific name or extension, and resolve file conflict with the skip, replace or rename option.

Download: Folder Merger (Free)

2. WinMerge

winmerge file difference comparison

WinMerge serves a different purpose than Folder Merger with a clean user interface. It is an open-source differencing and merger utility for Windows. A handy tool if you want to compare multiple text documents to find the differences. It can compare text-based documents, images, web pages, and more from a folder for differences and then perform a merge.

To compare and merge documents using WinMerge:

  1. Click on File and select Open.
  2. Select the first file or folder and then the second file or folder. You can select up to three files or folders to cross-compare.
  3. Click Compare to load and compare the files.
  4. If it is a text file, WinMerge will highlight the difference within lines between the selected documents.
  5. To merge individual changes in the document, click on the highlighted text and select Copy from right or Copy to right, depending on which version you want to merge.
  6. To merge all the changes, press Ctrl + A to select all the text and then use the copy option. It also supports difference comparison for images, web pages, binary files and tables.

In addition, it features support for shell integration, good plugin and archive file support with 7-Zip.

Download: WinMerge (Free)

The Best Apps to Merge Files and Folders on Windows

Windows 11 can detect and prompt copied folders in the same level to be merged. However, if you need to work with multiple folders frequently, a PowerShell script or a GUI-based tool like Folder Merger makes the task much easier.


Source link

Leave a Reply

%d bloggers like this: