2

I need copy lot of *.txt file from multiple folders to one.

I try use for exp.:

xcopy D:\Dokumenty\*.txt D:\final /sy

But this make 1:1 copy of folder. I need copy only files to a new folder.

Thanks for help.

2 Answers 2

3

You can also use wildcard (?*) in ROBOCOPY

usage: ROBOCOPY source destination [file [file]...] [options]

Transposing your example should look like this:

ROBOCOPY "D:\Dokumenty\" "D:\final" *.txt /S
Sign up to request clarification or add additional context in comments.

3 Comments

I try this, but it copy files and subfolders.
@Firejs remove /S which is what also make xcopy in your example.
I strongly suggest running robocopy with multiple threads: Try to compare using the /mt switch.
2
for /r "D:\Dokumenty\" %%# in (*.txt) do copy /y "%%~f#" "D:\final"

1 Comment

Robocopy will often be much faster than a regular copy - especially if you run it with the /mt switch.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.