Solved

Recursive Copy (xxcopy /sg) without xcopy

Posted on 2009-04-08
2
1,286 Views
Last Modified: 2012-05-06
I have xxcopy that works great.  If I say xxcopy /sg c:\test\*.txt c:\textfiles ... it will find text files that reside in all folders on the c:\test\* directories and copy them to textfiles (leaving folder structure behind.  How do I copy all types of a file from multiple folders to a single folder without installing xxcopy ?  Essentially, xcopy /s, but wihtout bringing over all of the folders?
0
Comment
Question by:weklica
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 2

Expert Comment

by:azaghlool
ID: 24103452
Hello,

It sounds like you need to create a batch file with several xcopy commands.  One for each source folder you wish to copy.
0
 
LVL 16

Accepted Solution

by:
t0t0 earned 125 total points
ID: 24105798
From a command line:

for /f "tokens=*" %a in ('dir /a-d /b /s "c:\SourceFolder\"') do @copy "%a" "c:\DestinationFolder\"


or in a batch file:

@echo off
for /f "tokens=*" %%a in ('dir /a-d /b /s "c:\SourceFolder\"') do copy "%%a" "c:\DestinationFolder\"


A problem will occur if two files have the same name....Can you guarentee every file will have a unique filename?


0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

One of my most closely kept secrets is revealed in this discussion How to output text on the same line This question was recently posted in EE by Simon336697 (http://www.experts-exchange.com/Programming/Languages/Scripting/Shell/Batch/Q_2459…
Introduction: Recently, I got a requirement to zip all files individually with batch file script in Windows OS. I don't know much about scripting, but I searched Google and found a lot of examples and websites to complete my task. Finally, I was ab…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question