Solved

Recursive Copy (xxcopy /sg) without xcopy

Posted on 2009-04-08
2
1,249 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

VALIDATING DATES One method of validating dates is to jam the date into the DATE command and see if it accepts it by examining the system's errorlevel value. A non-zero result indicates failure. A typical example might look something like the fol…
YESTERDAY YESTERDAY.BAT is inspired by a previous article I wrote entitled: TOMORROW.BAT (http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/MS_DOS/A_4196-Advanced-Batch-File-Programming-TOMORROW-BAT.html). The crux of this batch f…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

867 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now