[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

XCOPY

Posted on 2011-03-08
14
Medium Priority
?
541 Views
Last Modified: 2012-05-11
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....
0
Comment
Question by:elwayisgod
[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
  • 5
  • 3
  • 2
  • +3
14 Comments
 
LVL 13

Expert Comment

by:AustinComputerLabs
ID: 35073578
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
 
LVL 3

Expert Comment

by:fireline1082
ID: 35073624
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
 
LVL 8

Expert Comment

by:ragnarok89
ID: 35073629
I don't think this is possible with xcopy.

You could just create a batch file to do this, or try xxcopy
0
Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

 

Author Comment

by:elwayisgod
ID: 35073636
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
 

Author Comment

by:elwayisgod
ID: 35073666
Is it possible with any other scripting like VB?
0
 
LVL 13

Expert Comment

by:Rick
ID: 35073669
for /f "tokens=*" %a in ('dir /b /s /a-d "C:\users\darcy\Music') do @copy "%a" "C:\Music"
0
 
LVL 8

Accepted Solution

by:
ragnarok89 earned 1000 total points
ID: 35073742
XXCOPY C:\*.*  D:\mydocs\   /SL
0
 
LVL 13

Expert Comment

by:Rick
ID: 35073784
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
 
LVL 13

Expert Comment

by:Rick
ID: 35073824
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
 

Author Comment

by:elwayisgod
ID: 35074976
XXCOPY is not recognized as a operable program.....
0
 

Author Comment

by:elwayisgod
ID: 35074992
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
 

Author Comment

by:elwayisgod
ID: 35075198
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
 
LVL 6

Expert Comment

by:LeeeRussell
ID: 35080492
Looks like a typo on the XCOPY one:

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

Try that instead.
0
 
LVL 6

Expert Comment

by:LeeeRussell
ID: 35080511
Please ignore my last comment, I hadn't heard of xxcopy before.
0

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

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…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

650 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