using the "move" command via command line

Posted on 2007-10-04
Last Modified: 2012-08-13
Hello there - first off thanks for taking a look and my problem.
The situation: I'm writing one line of code to move data from a to b and I'm getting an syntax incorrect error. There's a good reason for doing this via command but I won't bore you with the details:)

Code: move G:\uploads\* H:\old users\departed employee images\
Error: The syntax of the command is incorrect

The G: drive is a internal hard drive and the H: is an external drive attached to the same system. All necessary rights have been setup/verified on the traversed directories. Spelling and directory paths have been ruled out. I ran the same command on some test directories in the root of C:\ without any trouble.  

Any input is much appciated!
Question by:CG_HD
    LVL 95

    Expert Comment

    by:Lee W, MVP
    USE QUOTES for paths with spaces and use the full wild card specification:
    move "G:\uploads\*.*" "H:\old users\departed employee images\"

    Author Comment

    Using "G:\uploads\*.*" "H:\old users\departed employee images\" I get a slightly different error...

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

    The filename,  directory name and volume label  (G: and H:) have been verified.

    LVL 82

    Accepted Solution

    The internal move command will only work in the same partition, you can't move files or folders across partitions with it.
    Either use robocopy from the W2k3 ResKit, which will (with the argument /mov) copy, then delete the source, or use two commands in your batch, one for the copy and one to delete the source:

    copy  "G:\uploads\*" "H:\old users\departed employee images"
    if not errorlevel 1 del /f /s /q "G:\uploads\*"

    Windows Server 2003 Resource Kit Tools

    Author Comment

    Thanks oBdA - with a little tweeking that work perfectly...I appreciate everyone's help!

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    This article was inspired by a question here at Experts Exchange ( The requirements stated in that question are (1) reduce the file size of a large number of…
    How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now