command line : move folder and subfolders

Posted on 2006-05-10
Last Modified: 2008-01-09
is there a command line to move a folder and all subfolders & files  to an other folder on the same drive ?

not copy then delete but really move (not robocopy / move ),

because gigas of data, and about 300 folders to deal with...

Question by:ingetic
    LVL 7

    Expert Comment

    The DOS command move should work.

    Moves files and renames files and directories.

    To move one or more files:
    MOVE [/Y | /-Y] [drive:][path]filename1[,...] destination

    To rename a directory:
    MOVE [/Y | /-Y] [drive:][path]dirname1 dirname2

      [drive:][path]filename1 Specifies the location and name of the file
                              or files you want to move.
      destination             Specifies the new location of the file. Destination
                              can consist of a drive letter and colon, a
                              directory name, or a combination. If you are moving
                              only one file, you can also include a filename if
                              you want to rename the file when you move it.
      [drive:][path]dirname1  Specifies the directory you want to rename.
      dirname2                Specifies the new name of the directory.

      /Y                      Suppresses prompting to confirm you want to
                              overwrite an existing destination file.
      /-Y                     Causes prompting to confirm you want to overwrite
                              an existing destination file.

    The switch /Y may be present in the COPYCMD environment variable.
    This may be overridden with /-Y on the command line.  Default is
    to prompt on overwrites unless MOVE command is being executed from
    within a batch script.
    LVL 7

    Author Comment


    i hadn't write the right question,

    I need to move all the subfolders & files of the main folder to another folder, but not the main folder

    if i have
              file 0
       file 1

    to move to folder Z (all inside folder A),

    move A Z works but moves the folder A
    move a\* Z move only files inside A but not subfolders
    LVL 7

    Author Comment

    found it

    cd %1

    for /f "delims=" %%a in ('dir /b') do (
      move "%%a" %2
     cd ..


    Accepted Solution

    PAQed with points refunded (500)

    Community Support Moderator

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Preface Having the need * to contact many different companies with different infrastructures * do remote maintenance in their network required us to implement a more flexible routing solution. As RAS, PPTP, L2TP and VPN Client connections are no…
    A quick step-by-step overview of installing and configuring Carbonite Server Backup.
    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…
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    729 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

    20 Experts available now in Live!

    Get 1:1 Help Now