How to Move Files from Subfolders to Main Folder in Windows

Jerry updated on Jul 05, 2024 to Backup and Recovery | How-to Articles

There are multiple ways to move all files from subfolders to main folder. The article discusses four ways using File Explorer, CMD, PowerShell, and Batch files to move all files from a subfolder to one main folder.

Moving files from an external device to the PC or creating multiple subfolders to store files will get messy as files pile up if you want to organize and move all files from subfolders to main folder only to end up tired. But Windows has other plans for you. The built-in features of Windows OS help you move the files with little work. In this post from EaseUS, you will learn how to move all files from subfolders to one main folder.

Move Files from Subfolders to Main Folder Using File Explorer

Let us see how to move files from subfolders to a main folder using File Explorer

Step 1. Open File Explorer and head for the folder containing the subfolders and files you want to move.

Step 2. Let's assume the folder contains many files and subfolders from which to select. To avoid manually selecting files, type the command below and press Enter.

  • *.* NOT type:"file folder"

The command will direct the File Explorer to select all the files from the search results, excluding all the folders.

Step 3. Click CTRL + A to select all the files. You can click on the cut or copy to move them. Remember that cutting will delete the files from the source folder.

Step 4. Go to the main folder and click CTRL + V to paste the selected files.

The advantage of File Explorer is you can select files of a particular type (MP3, text) to move or copy. The Kind features help you choose all the similar files. You should type Kind: document into the search box and click Enter. You will get multiple file types to choose from.

Share this article on your social media to help others move files from the subfolders to the main folder.

 

Move Files from Subfolders to Parent Folder Powershell

Windows PowerShell can help you move files. PowerShell is built into the Windows OS and is capable of changing PC settings and managing files, folders, apps, and more. Let us see the commands to use with PowerShell to move files from one folder to another.

Step 1. Launch Windows PowerShell with admin privileges.  Search for the PowerShell app and click on Run as an administrator.

Step 2. The PowerShell method involves creating the Destination (Main folder) and moving the files from the Source folder.

Step 3. Type the command and press Enter.

  • New-Item -ItemType Directory -Path "Destination"

Upon execution, the command will create a new folder to store the files you want to move. As you can see in the picture, I want to store the files in the "MainFolder" of D drive. Specify the destination address based on your needs.

Step 4. Type the command below to create the source folder. 

  • Set-Location -Path "Sourcefolder"

The command will modify the current directory to the source filter containing the files. Replace the Sourcefolder with your source file address.

Step 5. Finally, run this command to copy all files in subfolders to the main folder. Replace the "DestinationFolder" with your destination folder path.

  • Get-ChildItem -Recurse -File | Copy-Item -Destination "DestinationFolder"

Tip: The Move-Item command also helps you move files from a source to a destination. The Copy-Item will copy the files from the source folder, whereas the Move-Item will delete the files in the source file after copying.

Move All Files from Subfolders to Main Folder CMD

If you are familiar with Command Prompt, it offers fantastic functionalities for moving all files from the subfolder to the main folder. Follow the guide below:

Step 1. Launch Command Prompt with Admin privileges.

Step 2. We will first create a new folder to copy all the files. The command line below will create a new folder. Replace the MainFolder with the path of your choice.

  • md "MainFolder"

Step 3. Once you create the destination folder, you must alter the current directory to the source folder containing files and subfolders. Run the command below to do so. Replace the "SourceFolder" with your source folder path.

  • cd /d "SourceFolder"

Step 4. Run this final command to copy the files in the subfolders in the source folder to the main folder. Replace the "MainFolder" path.

  • for /r %d in (*) do copy "MainFolder"

Tip: Like PowerShell, you can replace the copy with Move to move the files.

Move All Files to Main Folder Using Batch File

Batch files are just like executing commands with CMD or PowerShell, except you don't have to execute files one after the other. The batch files will also be moved to a main folder. Let us create a batch file and execute it to move all files.

Step 1. Open the Notepad with a new file.

Step 2. Copy the items below and paste it into a text file. Replace the "FolderwithSubfolders" and "MainFolder" paths.

  • @echo off
  • set SOURCE_FOLDER=FolderwithSubfolders
  • set DESTINATION_FOLDER=MainFolder
  • if not exist "%DESTINATION_FOLDER%" (
  • mkdir "%DESTINATION_FOLDER%"
  • )
  • for /r "%SOURCE_FOLDER%" %%f in (*) do (
  • move "%%f" "%DESTINATION_FOLDER%\"
  • )
  • echo All files have been moved to %DESTINATION_FOLDER%.
  • Pause

Step 3. Click on File and select Save As.

Step 4. Rename the file name with the .bat extension and select the Save as type to All Files (*.*).

Step 5. Go to the batch file, right-click on it, and Run as administrator. It will be redirected to CMD, and all the lines will be executed automatically.

How to Sync Files Between Folders in Windows 11/10/8/7

Command-line tools like CMD and PowerShell require you to be tech-savvy. Even if you work around the tools, tasks like sync and backup take up heavy manual work. The sync features of EaseUS Todo Bacup, one of the best file/folder sync software for Windows, automate the sync between folders to backup files on your PC.

EaseUS Todo Backup, a professional free backup software, automates the sync and backup operations. Advanced backup solutions and automation help you keep files in sync and back up files automatically. You can sync files between folders, hard drives, cloud storage, and over networks.

Additionally, features like disk cloning, creating rescue disks, and cloud storage give you excellent backup options. Sync your files with EaseUS Todo Backup once and decide the frequency to automate the process.

step 1. Launch EaseUS Todo Backup and click New Sync button in the bottom-left corner.

Step 2. Click Select sync path from the left side.

Step 3. Choose a folder that your want to sync, and click OK. The source folde can be from Desktop, My Documnets, Favorites, Computer, Network, or NAS.

Step 4. Select a target location where you want to sync files to. You can choose Two-way sync or One-way sync method according to your needs.

Bonus: Tap Options button to select a sync scheme, which can schedule a sync task on daily, weekly, upon an event, or real-time sync.

Step 5. Click Sync Now to start a sync task right now.

Step 6. Wait for the sync process to finish, you can see a File Sync column in the top-left corner.

To Sum Up

If you have many files on your PC, navigating between them can be challenging. A great solution is to organize them by moving all or similar files to a main folder. This post helps you move all files from subfolders to the main folder.

Important files must be kept in sync to update as you make changes. With EaseUS Todo Backup, you can sync files between folders and hard drive/cloud/network to safeguard them. Get Todo Backup now, and sync all your files.

FAQs on Move All Files from Subfolders to Main Folder

Here are some of the most frequently asked questions about " moving all files from subfolder to main folder."

1. Can you move folders with subfolders without moving all files inside them?

The modern file system majorly works on the concept of pointers. When the OS organizes files on the PC, it's just a series of pointers pointing towards the directories. So, you can move folders with subfolders without moving files inside them.

2. How do I move all files from subfolders to main folder?

Manually moving all files from subfolders to one main folder will work for a limited number of files. If the number of files is high, you must rely on CMD or PowerShell commands like copy or Copy-Item.  

3. How to move all files in current folder to subfolder?

Using CMD or PowerShell to move files from the current folder to a subfolder can be tricky. So, create a new directory in the same folder. Copy all the files except the new folder and add them to the new folder. 

4. How do you remove all files from subfolders and relocate them to one folder?

Create a new directory/folder on your PC (name it main folder). Find all the files you want to move and select them. Open the new directory and click on PASTE.