≡ 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"
{ 10 comments… add one }
  • Marius July 4, 2014, 7:53 am

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

    move file1 file2 destinationDirectory ?

    • Charles August 21, 2014, 6:35 pm

      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 January 19, 2015, 4:58 pm

    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 January 24, 2015, 10:29 pm

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

  • nirav August 31, 2015, 4:01 pm

    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.

  • usman November 26, 2015, 6:31 am

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

    • Prateek May 17, 2016, 6:03 pm

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

  • Bilal February 26, 2016, 7:12 am

    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 April 16, 2016, 11:19 am

    Hello ALl,

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

  • Alex May 19, 2016, 6:53 pm

    can I use batch file to execute command?
    Thank you

Leave a Comment

Next post:

Previous post: