Solved

Recursive Copy (xxcopy /sg) without xcopy

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

TOMORROW TOMORROW.BAT is inspired by a question I get asked over and over again; that is, "How can I use batch file commands to obtain tomorrow's date?" The crux of this batch file revolves around the XCOPY command - a technique I discovered w…
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…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

772 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

11 Experts available now in Live!

Get 1:1 Help Now