XCOPY Syntax?  Flatten Tree Structure.

Posted on 2003-03-28
Medium Priority
Last Modified: 2008-01-09
Okay, all you old school DOS hackers, here's one that I've never thought about before..  

I've got a tree of files..  ie.  Folder1\Font1.ttf, Folder2\Font2.ttf

I want to "collapse" all the files in all those sub-folders into ONE folder.

IE, I end up with \FinalFolder\Font1.ttf and \FinalFolder\Font2.ttf.

I Canna figure any syntax (easily) to do that.

Suggestions are appreciated!

-- Scott.

Question by:scdavis
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

Accepted Solution

billious earned 1000 total points
ID: 8229670
Since you don't say what Folder1 and Folder2's parent folder is, I'll not only call it a directory, but I'll name it "Folder" and presume you want to get the files there, too.

for /f "tokens=*" %i in ('dir/s/b/a-d path\to\Folder') do copy "%i" "path\to\FinalFolder"

(I'll presume you COPY rather than MOVE, to prevent accidents....)


Expert Comment

ID: 8229673
...Of course, add "\*.ttf" to path\to\Folder to select files "*.ttf"


Author Comment

ID: 8229735
Thanks, Bill.

Worked like a charm.

Most of the syntax I'm familiar with ..  excluding the variable passing.

If you have time, please contact me via email direct (scott DOT davis AT beanfield.com).

I'm really curious where you learned those variable handlers.

certainly ain't in the dir /? "man page".

My Sincere thanks,



Featured Post

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
This month, Experts Exchange’s free Course of the Month is focused on CompTIA IT Fundamentals.
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses
Course of the Month12 days, 1 hour left to enroll

752 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