Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi.. I would like to know if it is possible to move/copy folders from one location to another location. All my folders are named as X_A_Y_htmls, X_B_Y_htmls, X_C_htmls. I tried using X_*_Y in the move command, but it treats it as a duplicate. Do i need to use looping for this? If yes, please illustrate. Thanks in advance

Something like this perhaps?
for /d %%a in (X_?_Y_htmls) do move "%%~fa" "folder" for /d %%a in (X_?_Y_htmls) do xcopy /e /i /-y "%%~fa" "folder\%%~nxa"[edit]
They are two separate commands, one moves the other copies.
They shouldn't be used togther.
[/edit]

Thanks.. Its working for the case ?_1594 or ?_1987 to put A_1594,B_1594,C_1594 or A_1987,B_1987,C_1987 into two folders 1594 and1987. The case its not working is ?xyz to put Axyz or Bxyz in xyz folder. There are around 10 files ie Axyz,Bxyz,Cxyz... which should go into xyz folder.

"There are around 10 files ie Axyz,Bxyz,Cxyz... which should go into xyz folder."
If they are files you should remove the "/d" switch(match against directories), and of course xcopy should turn into a copy command instead, though copy should work fine with out the for loop.

Thanks a lot! it worked. The number of files did not have anything to do. I realised late that ? means one character. so if xyz_1594 is needed it has to be ???_1594. Anyways thanks a lot for the immediate help.

![]() |
![]() |
![]() |
| Login or Register to Reply | |
| Login | Register |
| Ads by Google |