XCOPY

I need to copy all files of a directory and all of its subdirectories to a specified location.  However I don't want the folders.  I just want all the files.  Basically trying to flatten out a structure.

Source Dir:  C:\users\darcy\Music

Target Dir:  C:\Music

Can I use xcopy?  I can't use robocopy as it's a work computer....
elwayisgodAsked:
Who is Participating?
 
ragnarok89Connect With a Mentor Commented:
XXCOPY C:\*.*  D:\mydocs\   /SL
0
 
AustinComputerLabsCommented:
Are you saying you do not want any of the folders inside of the music dir, just all of the files dumped into a single directory?
0
 
fireline1082Commented:
I do not  think u can do (files and subs) using xcopy.

But u can do it using VHS script where u need to loop through the folders and copy the files.

I have similar script to delete files (not copy). I will pass it to you tomorrow when I reach the office.

Copy should be similar.
0
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

 
ragnarok89Commented:
I don't think this is possible with xcopy.

You could just create a batch file to do this, or try xxcopy
0
 
elwayisgodAuthor Commented:
Yes.. I need to just take all the files from a Dir and all it's Sub Dir's and dump them into a single directory.
0
 
elwayisgodAuthor Commented:
Is it possible with any other scripting like VB?
0
 
RickCommented:
for /f "tokens=*" %a in ('dir /b /s /a-d "C:\users\darcy\Music') do @copy "%a" "C:\Music"
0
 
RickCommented:
Sorry... my previous post didn't work in Windows 7.

Try this:

Open a dos window:
navigate to C:\users\darcy\Music
Enter this command and press enter:

  for /f "tokens=*" %a in ('dir /b /s /a-d') do @copy "%a" "c:\Music"
0
 
RickCommented:
No wonder it didn't work... I forgot to close quotes!
Try this (you won't need to navigate to the root directory):

for /f "tokens=*" %a in ('dir /b /s /a-d "C:\users\darcy\Music"') do @copy "%a" "C:\Music"
0
 
elwayisgodAuthor Commented:
XXCOPY is not recognized as a operable program.....
0
 
elwayisgodAuthor Commented:
Rick,

When I try yours I get:

C:\Temp>call music.bat > sam.log
\Users\Darcy\Music"') do @copy "\MusicFiles" was unexpected at this time.
0
 
elwayisgodAuthor Commented:
Rick,

If i just run what you said and not put it in a .bat file and then call it, it works.. however there are duplicates and it stops and asks me to overwrite or not... Is there a parameter I can put in so it automatically overwrites?
0
 
LeeeRussellCommented:
Looks like a typo on the XCOPY one:

XCOPY C:\*.*  D:\mydocs\   /SL

Try that instead.
0
 
LeeeRussellCommented:
Please ignore my last comment, I hadn't heard of xxcopy before.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.