1
The MOVE command does not work when to ovewrite a directory. I have also tryed to run cmd with admin rights.
I'm posting this question with more info so you can easily test it self.
Make your own folder somewhere and open command window at that location. Then copy and paste this block into cmd-window to create teststructure
MD aaa\test\a MD aaa\test\b MD bbb\test\b MD bbb\test\c MD ccc\test\a MD ccc\test\c ECHO hello > aaa\test\a\a.txt ECHO hello > aaa\test\b\b.txt ECHO hello > bbb\test\b\b.txt ECHO hello > bbb\test\c\c.txt ECHO hello > ccc\test\a\a.txt ECHO hello > ccc\test\c\c.txt
Now I want to move and merge all "test" folders in ".\test"
The MOVE command is fine, but in win 7 it fails(Access Denied) when to overwrite existsing "folders". if you now try following block one by one, the first will be ok, but next will fail.
move /Y aaa\test .\ move /Y bbb\test .\ move /Y ccc\test .\
However I have found other solutions which does the the same.
XCOPY aaa\test test\ /E/Y XCOPY bbb\test test\ /E/Y XCOPY ccc\test test\ /E/Y RD aaa\test /Q/S RD bbb\test /Q/S RD ccc\test /Q/S
XCOPY and Then Remove Directory
ROBOCOPY aaa\test test\ /E /IS /MOVE
ROBOCOPY with the /Move option
COPY command is totally useless in this case...
I do really need MOVE command to get a batch file with this contetnt to work wich worked in XP.
move /y "%1" c:\mydir\
I tryed robocopy, but then it will move only the contents of the folder. not the folder completly.
robocopy "%1" c:\mydir /E /IS /MOVE
If you wish to help me, then you can do it in two ways..
1) Find a solution to get MOVE to work as in XP
2) Find a way to do the same as what move /y "%1" c:\mydir\ does
A suggestion could be to get the folder name from the path and do something like this
// %1 = "c:\anotherdir\cool" if %1 is path_to_a_folder then ( get %foldername of %1 robocopy "%1" c:\mydir\%foldername /E /IS /MOVE ) else move /y "%1" c:\mydir\
EDIT:
Hey this works fine for directoryes, what more can i do so the script also can work with files?
robocopy %1 "C:\Users\azizkar\Desktop\ebben\%~n1" /E /IS /MOVE
1The
move
command did not work like that in XP. It has always behaved like this (it cannot merge or overwrite directories). – Bobson – 2011-09-24T01:35:37.210You have right. I tryed it in XP yesterday and it was the same. Sorry about my mistake. I was sure that this worked earler, but it did'nt. – Aziz – 2011-09-27T09:33:13.343