≡ Menu

Move files and directories to another location

This tutorial explains how to move files or directories to another location on a Windows system.

Move files to another directory

move filename destinationFolder

Example: to move file ‘data.docx’ to the folder ‘d:\backup\folder’

move  data.docx  d:\backup\folder\

You can also rename the file while moving it to the new location

move data.docx  d:\backup\folder\newData.docx

We can’t move multiple files with single command. i.e the below command would not work.

move file1 file2  D:\folder1\folder2

This would give the error The syntax of the command is incorrect.

However we can use wildcards to move files in bulk.  For example, if you want to move all text files from current folder to a new location you can use the below command.

move *.txt  destinationDirectory

To move all files starting with letter ‘A’, you can use below command.

move A*  destinationDirectory

Move directories

Syntax:

move directory newDirectoryPath

Example: To move the directory ‘data’ to ‘D:\data\folder1\’

move data D:\data\folder1

1. Can we move multiple directories using wild cards like the way we do it with files?
No, wild cards does not work for directories. You get the below error

C:\>move tmp* Documents\folder1\
The filename, directory name, or volume label syntax is incorrect.

2. How to specify the directories/files which have white spaces in the names?
You need to enclose the name of the file/directory in double quotes.

Example: move "file with spaces"  "D:\directory with spaces"

Errors

If you do not have write privileges on source file/directory or on the destination folder, you would get error as below.

C:\Users\user1>move mydata.pdf c:\users\user2
Access is denied.
        0 file(s) moved.
26 comments… add one
  • Marius

    Could some one point out why windows command line could not execute

    move file1 file2 destinationDirectory ?

    • Charles

      Because with the syntax the command is expecting, you told it to move file1 to file2 (which already isn’t going to work) and then gave it an argument of destination Directory, which it then has no idea what to do with, cause it isn’t a valid argument, in addition to the command you issues failing.

  • bo

    very helpful, I am missing one piece, I am trying to move all files from a “Camera Uploads” folder (dropbox) to another folder… not sure how to do a move involving all files inside a directory with a space… any ideas… “C:\Dropbox\Camera Uploads\*.*” doesn’t work… thanks!

    • lolololol

      i think this would do the trick
      “C:\Dropbox\Camera Uploads\*”

  • nirav

    hi,
    can anyone suggest, how can I achieve below, via DOS command ?
    I want to move all files and folders from source folder to destination folder.
    e.g. C:\source\file1.txt
    C:\source\file1.txt
    C:\source\subsource\file1.txt

    I want to move everything form C:\source form C:\destination ( like CUT from C:\source and PASTE into C:\Destination)

    Thanks in advance.

    • Ehab Alasadi

      If you want to copy all files from C :\ to destination you can use

      move c:\> Source folder\*.* c:\destination folder

      -move Just files not folders

      if you to copy folder and files you can use XCOPY Command c:\xcopy *.* C:\ Destination folder

  • usman

    move -y “C:\source\file1.txt ” “C:\source\subsource\file1.txt”
    pause

    • Prateek

      Can I use wildcard * to recognize the source and subsource directory in command line?

  • Bilal

    is there any window service which did the same work as you mentioned above. i.e transferring a file from one folder to another specified folder by a specific time interval in the background automatically. if you have some link regarding this please do share

  • Krishna

    Hello ALl,

    Please suggest me how to move folders like 0123-03-000000001 to “Done” folder through batch file.

  • Alex

    can I use batch file to execute command?
    Thank you

  • Arup

    wow! lots of examples for windows move command. Thanks for sharing.

  • Ryan

    Hey Guys,

    Id like to create a script to move files of a size between let say 200 – 500MB from a specific location to another location.

    Anyone know how to do this ? :)

  • Mike Eng

    Hey I would like to know how to move a folder or move files to a folder while naming the folder to Program Files and on the Desktop

  • Paul

    I have a batch scrip that creates a sql dump then copies it to another server. I’m looking to move it so it is deleted from the directory originally created in. I tried the MOVE command but it doesn’t do anything. The script that works with just copying it is below anyone have any thoughts on how to modify this?

    @ECHO OFF

    set TIMESTAMP=%DATE:~10,4%%DATE:~4,2%%DATE:~7,2%

    REM Export all databases into file C:\DB Backups\backup\docuware.[year][month][day].sql
    “C:\Program Files (x86)\DocuWare\Internal Database V2\bin\mysqldump.exe” –all-databases –result-file=”C:\DB Backups\docuware.%TIMESTAMP%.sql” –user=admin –password=Toshiba1

    REM Change working directory to the location of the DB dump file.
    C:
    CD \DB Backups

    COPY “C:\DB Backups\” “E:\DW_PROD\Database Backups\Toshiba Tamarac Internal”

  • lakshmaan

    HI, Please provide how to move directory in to anoterh locatp

  • Sajuliet Guerra

    Hi, could you please help! I keep getting a The filename, directory name, or volume label syntax is incorrect error.
    MOVE /-y “\\XYZ-nas\active matters\ABC\Morning\D1\processed\PDF\008\Morning_0086126__*.pdf” “\\XYZ-nas\active matters\ABC\Morning\D1\processed\Loose\07. Rathburnadette Email\top\Inbox\FW: BGD (unknown)\”

  • Prasad

    Hi,
    Can anyone help me to move the files from multiple folders to multiple folders?
    Example: I have folders like folder1 and in folder1 I have file1 and file and folder2 in folder2 I have file 3 and file and the destination folders are folder 3 and folder4.
    we need to move the folder1 files to folder3 and folder2 files to folder4 at a time not one by one.

  • gregory rudowsky

    i have about 200,000 files that i want to write a program to move them (by key word in file name ) to different folders

    move all files with any of these words in the file name (shtf,prepper,prepping,survival,bushcraft) to folder shtf

    thats an example…. sas, small basic, dos prompt any hints? tks

  • Bill

    Any way to perform a bulk move of files based on a string found inside the file? e.g. this does not work for me
    move findstr “StringToFind” *.xml D:\PROD\ExceptionFolder

  • Sagar Gandhi

    Hi
    I want to move files from one directory to another only the latest file names are like this filename20190904.csv. I want to move these from one folder to other and replace the files with latest. And also want to exclude one file from source folder. any help would be appreciated

  • Qharr

    Including how to move across a network drive would be useful

  • Brian Finch

    Does anyone know a command prompt command to extract all files from a directory and its sub-directories and move them all to another drive or directory? many thanks in anticipation

  • kuldeep

    Hi,
    I’ve created a React-App and I want to move a folder(React-App) from one directory(C:) to another(D:). How can I obtain this? Thanks in advance.

Leave a Comment