Copy files form several directories to One

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi;

I want to search a directory tree for all the *.txt files and copy them to a TXT directory.
I do NOT wish to copy the existing directory tree to the TXT directory. I have tried robocopy
and Xcopy, but they both recreate the Directory tree.

Any help would be appreciated.

M
 
Mike said:
Hi;

I want to search a directory tree for all the *.txt files and copy them to a TXT directory.
I do NOT wish to copy the existing directory tree to the TXT directory. I have tried robocopy
and Xcopy, but they both recreate the Directory tree.

Any help would be appreciated.

M

From the CMD prompt:

for /f "tokens=*" %a in ('dir /s /b *.txt') do @echo copy "%a" \TXT

In a batch file, use '%%a' instead of '%a'.
 
Back
Top