• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Allow trailing backslash in MOVEDIR args

Apr 13, 2010
The Hague
MOVEDIR and COPYDIR already support that. Csn you give an ecample of what you are doing that doesn't work?
md .\dir1
touch /c/q .\dir1\file1.tmp
md .\dir2
touch /c/q .\dir2\file2.tmp

:: Works:
movedir .\dir1 .\dir2\

:: Error:
movedir .\dir1\ .\dir2\
Personally, I think the second syntax is clearer. Although one could allow the omission of the final "\" for convenience, I feel it should not be mandatory.


Staff member
May 14, 2008
I don't think this is what you really want.

MOVEDIR doesn't want the destination directory to exist. Because your destination directory (dir2) already exists, MOVEDIR will append the last subdirectory name in source to destination, create the new subdirectory, and move source to destination. (See the help for MOVEDIR.)

So if MOVEDIR stripped the trailing \ from the source, you'd end up with "movedir .\dir1\ .\dir2\dir1", which seems unlikely to satisfy you.

If you really want to move the contents of a directory to an existing directory, you should be using the MOVE command.
Apr 13, 2010
The Hague
I would use MOVE to merge, and MOVEDIR to move directory .\dir1 into .\dir2, leaving me with .\dir1\dir2, and be satisfied and say thank you very much.

What am I missing?

Everywhere .\dir is equivalent to .\dir\

I have always thought about it as the first variant being ambiguous; it could be a file without an extension or it could be a directory but we need disk i/o to verify that. On the other hand, the notation .\dir\ can only refer to a directory.

Since we're moving directories here, I would say the second notation is "natural" to the MOVEDIR command and the first could be allowed.
You seem to be saying it should be penalized?

Actually, what I would *really* like is, use MOVE for both operations

MOVE .\dir1 .\dir2
...\dir1\*.* => ...\dir2\dir1\*.*


MOVE .\dir1\ .\dir2
...\dir1\*.* => ...\dir2\dir1\*.*

... since the source describes a directory,
as apposed to:

MOVE .\dir1\*.* .\dir2
...\dir1\*.* => ...\dir2\*.*

... since the source describes files.
Top Bottom