Xcopy command help.


Recommended Posts

Hey;

I'm trying to copy lots of files from sub folders to a main folder, was wondering is there anyway I could use the Xcopy command to do so?

Basically lets say the files are located in====> G:\Archives\Apple\Apple 1\(2 files here), G:\Archives\Apple\Apple 2\(3 files here) and so on... and I want to copy all those files to G:\Archives\Apple\ , assuming they all have different names. is there anyway I could do this by using Xcopy?

P.S: not sure it's the right section to post this, but since I'm using RC windows7 thought might be safe to post here.

Thanks;

Mani

Link to comment
Share on other sites

two or three different type of files, but if I could figure how to copy one of the types, I could run the command twice or three times for different extensions.

but if the command could be for something like *.* that would even make it better.

Link to comment
Share on other sites

create a batch file and paste this:

@echo off

setlocal

REM ** Would change these as needed
set srcDir=drive:\sourcedirectory
set destDir=drive:\destinationdirectory

for /f "delims=" %%a in ('dir "%srcDir%" /s /b 2^>NUL') do copy "%%a" "%destDir%"

Link to comment
Share on other sites

Thanks alot ;) Really appreciate it.

Actually is there anyway to instead of copying it, move the files ?

update: changed the do copy to do move and worked perfectly, Thanks again.

Edited by Mr_Baby
Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.