I am trying to create a batch file that should move files AND directories + all subdirectories from one place into another

For example, let's say I have these:


When I use move C:\Source\*.* C:\Dest\ ONLY abc.files show up on the destination folder. I need the whole content of Source directory with ALL its subdirectories contents

3rd party solutions (besides DOS) are OK... if they are free and virus free. =)

  • 2
    DOS is a distinct OS. If you're running any version of Windows more recent than Windows ME then you're not using DOS. May 12, 2018 at 6:23
  • If you notice carefully, I am making a batch file (ej. automation.bat) with several inline-commands (DOS ATM). Regardless of the windows version, anyone can do that and use DOS
    – Omar
    May 12, 2018 at 6:26
  • 4
    No, you're using command line tools, not DOS. May 12, 2018 at 6:27
  • 1
    You're writing a batch. That said, why not just move Source? Also your current filter is looking for objects with a dot. Dir1 etc. don't have that. So just use * instead and try again instead of *.*.
    – Seth
    May 12, 2018 at 7:57
  • 1
    Assuming you are using Windows 7+, how about XCOPY /E /I /Y "Source" "Destination" (XCOPY) or perhaps (preferably) Robocopy? May 12, 2018 at 8:42

1 Answer 1


You're running into two problems here.

The first is that you told move to only copy files that have a name that matches the *.* pattern. Dir1 and Dir2 both do not match *.*. (Neither has a "." (dot) in the name). @Seth pointed this out in a comment on your original post.

The second problem is that move doesn't have sane (imho) behavior when you ask it to move a folder and a file at the same time. Move simply refuses to move a folder if anything else is trying to be moved at the same time:

Moves a dir into another dir:

move C:\Source\Dir1 C:\Dest\

(now C:\Dest\Dir1 exists)

Only moves files at the top level inside C:\Source\:

move C:\Source\* C:\Dest\

(now C:\Dest\abc.files exists)

Produces a syntax error when you try to move two folders at once (neither syntax works for me)

move C:\Source\Dir1,C:\Source\Dir2 C:\Dest\
move C:\Source\Dir1 C:\Source\Dir2 C:\Dest\

The documentation for move suggests that you should be able to specify multiple files and folders to move at once with a comma (,) separating the files to be moved but this doesn't seem to work for me.

The documentation does say Moves files and renames files and directories. suggesting that it really can't move directories...

So, I don't think there is a solution that works for you with the move command that is available on DOS compatible machines. There are however other newer commands available in more recent versions of Windows that would likely work. xcopy is a popular one. This unfortunately doesn't work for me because xcopy does not do a filesystem level move, it only copies and then deletes the original. This is fine for smaller files but can be disastrous with larger files.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .