Powershell Move Files from One Folder to Another | Available for All🔥

The PowerShell move files from one folder to another using the Move-Item cmdlet. Let us see some PowerShell commands to perform various operations to move files from one folder to another, one registry to another, and one directory to another.

Page Table of Contents

Jerry

Updated on Mar 15, 2024

0 Views | 0 min read

Windows PowerShell is way more efficient and useful than the command prompt on Windows. But only a few know how to use it as it offers better and more efficient ways to move files from one folder to another on your computer. Let us learn how PowerShell move files from one folder to another from this article offered by EaseUS and some basic commands for various requirements.

Powershell Copy All Files from One Folder to Another - Is It Possible? 

PowerShell is a command line shell for cross-platform task automation. Along with command lines, it comprises scripting languages and configuration management, making it more useful and efficient than the command prompt. File Management is essential to remove redundancy and segregate and organize files. Since the manual process can be tedious, we will use PowerShell to do the work for us.

can I use PowerShell to copy all files from one folder to another

Yes, PowerShell can copy all files from one folder to another. PowerShell has a command called Move-Item cmdlet, which lets you transfer items, files, and folders on your PC from one place to another, along with the contents, properties, and child items. But, the same provider should support both locations (the target and the source). 

Moving a file is pretty easy, but while doing the same with folders, registries, and directories, we cannot do it manually for every file. With the move-item command, we can move files or subdirectories between directories, registry keys, and subkeys from one location to another or move an entire folder to another.

If you want to know how to use Xcopy Command to copy folder and subfolder, read the following article.

copy folders and subfolders using xcopy command

Copy Folders and Subfolders Using Xcopy Command

 In this post, you can learn what Xcopy is and how to copy folders and subfolders using the Xcopy command in various cases.

How to Copy from One Folder to Another Using Powershell

If you are new to using PowerShell, this seems confusing. Take a look at the examples below to understand how the commands for PowerShell move files from one folder to another.

  1. Case 1. Move a File to Different Directory, Then Rename It
  2. Case 2. Move a Directory and Its Contents to a Different Directory
  3. Case 3. Move Files of a Specified Extension from the Current Directory to Another
  4. Case 4. Recursively Copy All Files Of a Specified Extension from the Current Directory to Another
  5. Case 5. Move Registry Keys and Values to Another Key
  6. Case 6. Copy a Directory and Its Contents to a Subdirectory of the Specified Directory

Case 1. Move a File to Different Directory, Then Rename It

If you want to move a  single file from one directory to another directory while renaming it, you can follow the below command.

  • Move-Item -Path C:\directory1.txt -Destination E:\Target\directory2.txt

move a file to a different directory and rename it

With this command, you are transferring the directory1.txt file from the C drive to the Target directory of the E drive while renaming the file to directory2.txt from directory1.txt.

Case 2. Move a Directory and Its Contents to a Different Directory

The following commands let you transfer the contents of the entire directory, along with the subdirectories and files, to another directory.

  • Move-Item -Path C:\Source -Destination C:\Target

move a directory and all its contents to a different directory

Upon execution, the command will move all the contents of the Source directory to the Target directory, including everything.

Case 3. Move Files of a Specified Extension from the Current Directory to Another

Let's say you want to move all files of the MP3 extension from one directory to another; you can use this command.

  • Move-Item -Path .\*.mp3 -Destination C:\Music

move files of a specific file extension from the current directory to another

So, all of the mp3 files (indicated by *) in the current directory (indicated by .) will be moved to the Music directory.

Case 4. Recursively Copy All Files Of a Specified Extension from the Current Directory to Another

Now, what if you have more MP3 files in the subdirectories? The above case may not help you. So, you have to recursively move the MP3 files in every subdirectory and move them to the destination using the Child-Item cmdlet.

  • Get-ChildItem -Path ".\*.mp3" -Recurse | Move-Item -Destination "C:\MusicFiles"

copy all files of specific extensions from the current directory to another

This command will run recursively to move all the mp3 files in the current directory and its subdirectories to the MusicFiles directory.

Important
1️⃣If you are using PowerShell 2.0, the Path parameter must be a container when the Recuse parameter is being used with the Get-Children.
2️⃣Also, use the include prompt and the command to filter out the .txt files. (Get-ChildItem -Path . -Include *.mp3 -Recurse | Move-Item -Destination C:\MusicFiles)

Case 5. Move Registry Keys and Values to Another Key

See how to move registry keys and values within the registry to another one. 

  • Move-Item "HKLM:\software\mycompany\*" "HKLM:\software\mynewcompany"

move registry keys and values to another key

Here, the registry and key values of the MyCompany registry key located in HKLM\Software are moved to the MyNewCompany key. The (*) after the "mycompany" indicates that all the content of the MyCompnay key will be transferred, except for the key. 

Case 6. Copy a Directory and Its Contents to a Subdirectory of the Specified Directory

Learn the command to move and copy the directory and its contents to another subdirectory of a specified directory.

  • Move-Item -LiteralPath 'Music[Jan`10]' -Destination 'Music[2010]'

copy a directory and its contents to a subdirectory of the specified directory

This command will move the Music[Jan`10] directory and all its contents into the Music[2010] directory.

Notice:
1️⃣We use the LiteralPath parameter instead of using Path to handle the directory names with brackets.
2️⃣The single quotation marks, along with the directory names, are employed to enclose the Path, ensuring the (`) symbol is interpreted correctly.
3️⃣In the same case with the destination directory, the brackets and backtick quotations are used to avoid misinterpretation.

Is this article helpful? If so, share it on your social media to help more people.

 

Pro Tip: Automatically Backup Files Rather Than Copying

PowerShell is a great addition to your OS for various tasks but comes with the risk of losing or corrupting files when there are mistakes while executing a command. So, a better way is to automatically back up your files rather than moving from one place to another. This way, you can move the files while also safeguarding them from accidental deletion.

EaseUS Todo Backup is an auto and free backup tool with advanced backup algorithms to create a copy of your files safely. You can schedule the backup weekly or daily to automate the process to sit back and relax. It can back up your Windows to a USB drive and perform different backup types, like full, incremental and differential backups. The following are some highlights of this backup tool:

EaseUS Todo Backup

The tool can do it all, be it files, folders, or the entire system. Additionally, you can make images and clones and store the files on the cloud to keep them safe. Download the tool, and make a backup of your files now.

Step 1. To initiate a backup, click the Select backup contents option.

create file backup step1

Step 2. There are four data backup categories, File, Disk, OS, and Mail, click File.

create file backup step2

Step 3. On the left, both local and network files will be shown. You may extend the directory to pick the backup files.

File backup

Step 4. Follow the on-screen instructions and choose a location to store the backup.

File backup step4

Click Options to encrypt the backup with a password in Backup Options, then click Backup Scheme to specify the backup schedule and start the backup at a certain event. There are also other additional choices you may choose to tailor the backup process to your requirements.

Backup options

Step 5. The backup may be stored on a local disk, EaseUS' online service, or NAS.

file backup step4

Step 6. EaseUS Todo Backup enables customers to back up data to a third-party cloud drive as well as its own cloud drive.

If you want to back up data to a cloud drive provided by a third party, choose Local Drive, scroll down to add Cloud Device, and then add and log in to your account.

Backup to cloud
You can also choose the EaseUS cloud drive. Sign up for an EaseUS Account, then click EaseUS Cloud and log in.

backup to easeus cloud

Step 7. Click Backup Now to begin the backup process. The backup job will be presented as a card on the left side of the panel after it has been finished. Right-click the backup job to handle it further.

File backup step7

To Wrap Things Up 

The command line tools are confusing initially, but once you get used to them, you can have a ball. We have listed six scenarios of using PowerShell move files from one folder to another. Ensure you copy the commands exactly to avoid losing or corrupting files on your system. The best way to avoid accidents and keep your files is to automatically back them up using a professional backup tool like EaseUS Todo Backup. Along with a folder, you can also backup hard drives, make clones, and create system images with award-winning algorithms.

FAQs on Powershell Move Files from One Folder to Another

Here are some of the most frequently asked questions on PowerShell moving files from one folder to another. If you have similar queries, I hope this will help you.

1. Is there a script that will move files from one folder to another?

Yes, scheduling a batch script will automatically move files from one folder to another. You need to create a task to move the files from one folder to another and put it into an automated task.

2. How do you move multiple files to one folder?

Open the source folder, left-click on the first item, left-click on the last item while holding the Shift button to select all the files in the folder, and click on Cut. Now, go to the destination folder and paste the files.

3. How do you move files without copying Windows 10?

Instead of copying, you can Cut the files and paste them into the destination folder. The Keyboard shortcuts for this method are Ctrl + X to Cut and Ctrl + V to Paste.

EaseUS Todo Backup

EaseUS Todo Backup is a dependable and professional data backup solution capable of backing up files, folders, drives, APP data and creating a system image. It also makes it easy to clone HDD/SSD, transfer the system to different hardware, and create bootable WinPE bootable disks.

  • Updated by

    Jerry

    "I hope my articles can help solve your technical problems. If you are interested in other articles, you can check the articles at the bottom of this page, and you can also check my Facebook to get additional help."…
    Read full bio

EaseUS Todo Backup

Smart backup tool for your files, disks, APPs and entire computer.

  Try It Now

Support Windows 11/10/8/7