Celeb Glow
updates | March 09, 2026

how to move folders to another folder in command line [closed]

I want to move everything in batch folder to previous folder including all folders in batch but this command only moves files, not folders

move S:\Study\Study\batch\* S:\Study\Study\
2

1 Answer

it can be done using for /r or more easily using xcopy /e to copy the entire directory tree, including empty ones, and then deleting the original directory:

solution 1: internal command

for /r source %a in (.) do @move %a destination

notes

  • source can be absolute or relative path to the directory
  • destination should be the name of new non-existing directory, else the directory itself (root) will be moved into the existing directory

solution 2: external command

xcopy /e source destination
rmdir /s /q source

notes

  • the command is executed by %windir%\system32\xcopy.exe executable file
  • if destination does not exist, the user will be prompted whether destination specifies file (f) or directory (d) name
0