ManiD Posted June 17, 2009 Share Posted June 17, 2009 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 More sharing options...
hyb Posted June 17, 2009 Share Posted June 17, 2009 Do the files inside have the same extension? Link to comment Share on other sites More sharing options...
ManiD Posted June 17, 2009 Author Share Posted June 17, 2009 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 More sharing options...
Aldur82 Posted June 17, 2009 Share Posted June 17, 2009 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 More sharing options...
ManiD Posted June 17, 2009 Author Share Posted June 17, 2009 (edited) 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 June 17, 2009 by Mr_Baby Link to comment Share on other sites More sharing options...
Recommended Posts