Move files to parent folder in CMD

11,620

The error appears if there is nothing to move, see an example below. Try

move *.* .. 2>NUL

Example:

D:\test\a folder\with spaces>move *.* ..
D:\test\a folder\with spaces\New Text Document (2).txt
D:\test\a folder\with spaces\New Text Document.txt
        2 file(s) moved.

D:\test\a folder\with spaces>move *.* ..
The filename, directory name or volume label syntax is incorrect.

D:\test\a folder\with spaces>move *.* .. 2>NUL

D:\test\a folder\with spaces>
Share:
11,620
equazcion
Author by

equazcion

IT manager and web developer, currently trying to get user scripts (Greasemonkey etc) into the mainstream with a new repository: http://monkeyguts.com. Help me out and publish something!

Updated on July 22, 2022

Comments

  • equazcion
    equazcion almost 2 years

    I need a sanity check. I remember being able to run a command like this:

    C:\TestFolder> move *.* ..
    

    This should move all files in the current folder up one folder, ie. to the parent.

    Running this now, in a Windows 10 command prompt, I get the following error:

    The filename, directory name, or volume label syntax is incorrect. 
    

    I've looked through a bunch of similar questions at StackOverflow. Most answers say that some complex loop command is required to move files to the parent. Those that mention move *.* .. have some people saying this command works for them, while others report the same error I'm getting.

    One example: https://stackoverflow.com/a/25542277/2066896 (expand all comments to see the relevant exchange)

    Granted, I haven't needed to use this command in years, so perhaps support for the ".." notation in the move command was removed at some point in Windows' recent history. Or perhaps it was never there, and I'm just dreaming.

    Just wondering if someone can clear this up. Thanks!