How to Move a File from One Directory to Another in Terminal

By | April 8, 2022

Using this tutorial, you will be ably transmitting files or folders/directories on your Windows system to another location.

Transform files into a new directory:

How to Move a File from One Directory to Another in Terminal

move filename destinationFolder

Sample: The file [data.docx] should be relocated to the backup folder [d:/folder]

move  data.docx  d:\backup\folder\

The file can also be renamed as it has been moved new place.

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

A single command cannot move several files at the same time. Therefore, the following command will be ineffective.

move file1 file2  D:\folder1\folder2

The syntax of the command is incorrect, and an error will appear.

Wildcards can, however, be used to bulk-move files. Please do so if you wish, for example, all files must be moved that are contained in the current folder, you will be able to use this command to perform the migration.

move *.txt  destinationDirectory

Below is the command you can use to transfer all files beginning with the letter ‘A’.

move A*  destinationDirectory

You can move directories by following these steps:

#Syntax:

move directory newDirectoryPath</pre?

Sample: The data directory should be moved from ‘data/folder1/’ to D:/data
move data D:\data\folder1
  1. Are we able to use wildcards to multi-directory move as we do with files?
    For directories, wild cards are not supported. A message will appear as follows:
C:\>move tmp* Documents\folder1\
The filename, directory name, or volume label syntax is incorrect.
  1. What are the methods for specifying directories/files with spaces in their names?
    Double quotes are required around the files or directory name.
Example: move "file with spaces"  "D:\directory with spaces"

Logs of Errors:

You will get an error in the absence of writing access to the source directory or file, and The location of the folder is not accessible to you.

C:\Users\user1>move mydata.pdf c:\users\user2
Access is denied.
        0 file(s) moved.

Read: Run Command for Disk Management [Shortcut Windows]

Leave a Reply

Your email address will not be published. Required fields are marked *