Xcopy command is not working

Dell INSPIRON 1525
February 7, 2009 at 12:26:55
Specs: Windows Vista, Intel (R) Core(TM) 2 Duo CPU and 2038MB
As you answered for this topic "Copy files from mult. subfolders" , xcopy command is not working for me.

Actually I want to copy files from multiple subfolders (under the same parent folder) to another directory using DOS commands? For example, if I wanted to copy all files named *test* (any file type) located in folders C:\A\1\, C:\A\2\, C:\A\3\ and paste them in C:\B\, is that possible?

I have tried the below command without success.Could you please help me to solve this issue

C:\> C:\A\*.\*test* C:\B

With Regards
VasimRaja.R


See More: Xcopy command is not working

Report •


#1
February 7, 2009 at 17:53:18
Untested:
FOR /D /R "C:\A" %%a IN (*) DO COPY "%%~Fa\*test*" "C:\B"


Report •

#2
February 8, 2009 at 08:20:15
I am very soory.

getting this error...
"%%a was unexpected at this time."

Is there any way to fix this.

Regards
VasimRaja.R


Report •

#3
February 8, 2009 at 15:07:43
That has to be stuck in a Command Script, it can't be typed in to the command line raw.

Report •

Related Solutions

#4
February 10, 2009 at 11:09:04
I am not using any scripting languages,I want to execute the commands in command line (a black window) itself.I have tried xcopy command as follows

1. C:\> xcopy C:\A\*.\*test* C:\B

It is not working.I am getting this error
"File not found - *test*
0 File(s) copied "

But actually files are available in the subdirectories.


2. C:\> xcopy C:\A\*test* C:\B /S

This command copies all the files with the subdirectories i.e subdirectories are created while copying.I want to copy the files only.

Please get me out from this issue.


Regards
VasimRaja.R


Report •

#5
February 10, 2009 at 15:47:11
I want to execute the commands in command line (a black window) itself.
Still untested:
FOR /D /R "C:\A" %a IN (*) DO COPY "%~Fa\*test*" "C:\B"


Report •

#6
February 13, 2009 at 10:51:52
Thanks for your reply,Please let me know once it is tested.


Regards
VasimRaja.R


Report •


Ask Question