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 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"
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.