Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I'm trying to move all folders in "test" to the new folder "data"

move E:\test* E:\data\ but it does not work The system cannot find the file specified.

move E:\test E:\data this one works, but it copies also the test folder.

thanks in advance

share|improve this question

3 Answers 3

up vote 2 down vote accepted

move on windows doesn't do this for some reason.

My suggestion would be to use Powershell with the move-item cmdlet:

ps> move-item e:\test\* e:\data 
share|improve this answer
for /F "delims=" %a in ('dir e:\test /a:d /b') do move "e:\test\%a" e:\data
share|improve this answer
    
why not just use for /D? –  Harry Johnston Sep 24 '12 at 22:28
    
I am not sure, I don't think I've ever used FOR without /F :) –  dusan.bajic Sep 25 '12 at 14:02

Powershell (as per SvenW's answer) is best practice, but if you prefer the old fashioned command line:

for /D %i in (e:\test\*) do move "%i" e:\data

You have to double up the percent signs (i.e., use %%i instead of %i) in a batch file.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.