Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi. I have a deep directory tree. for example:
c:\0001
c:\0002
c:\0003
c:\0004Does anyone know how I can copy all of the files that start with T?
I've tried xcopy t*.* c:\test\*.* /s but this copies the folders\subfolders as well. I just want to end up with all of the files in one folder. Anyone have any ides?
I have way to many folders\subfolders to write a batch file going to each folder

You'd better post this question in Programming Forum or Windows XP Forum, as the warning messages of this forum state.
---------------
Long Live DOS!

Don't go in circles on computing.net when you could simply download cp.exe (the linux version of copy, that can do that task very simply). I'm not exactly sure where you can download that file directly, but it is part of the "Cygwin" linux toolkit released by redhat, try surfing through their ftp servers for it (it will be located in the path /bin/ directory under cygwin), or hell, just download the whole toolkit at http://www.cygwin.com/(it has a lot of great tools never seen on windows including ssh, etc)
Good luck
josh

Hi,
You said:
"Hi. I have a deep directory tree. for example:
c:\0001
c:\0002
c:\0003
c:\0004Does anyone know how I can copy all of the files that start
with T?"
Looks like your tree is WIDE, not DEEP.
In the case you show, run the BAT from C:\
But if it's DEEP and WIDE go to the directory immediately
above the folders of interest. Like this:
c:\a\b\x\z\w\0001
c:\a\b\x\z\w\0002
c:\a\b\x\z\w\0003
c:\a\b\x\z\w\0004If your tree looks like what's above,
cd c:\a\b\x\z\w
and run it from there. It copies only files in the
directories immediately below named T*.* and NOT lower
folders.
The /D at the END of the working line tells xcopy to copy only
newer files. If you want to copy all, regardless of date, and
don't want to be prompted for every overwrite, replace /D with
/F or if you want to be preompted, don't use either /D or /F.
You need to tell it where to put the files, like this:
MyNew.BAT e:\allTfiles\
Include the final \ and [1] it will create the folder if needed and [2] it won't ask you if the destination is a drive or directory.
Let me know if it's what you need.
******************************
@echo off > quit.bat
@echo echo %%1 %%2 %%3 %%4 %%5 %%6 %%7 %%8 %%9 >> quit.batecho.
echo This is the world famous %0.bat
echo.
echo copyright 2004 ThaiGuides.com All rights reserved
echo.
echo Free for private use. Others email: Consult@ThaiGuides.com
echo.
echo built and tested on windoze 2000; may act funny on other versions
echo.
echo.
echo. The purpose is to copy files from many folders below the current one
echo. to a single location
echo.
echo. 20:12 30 May 2004
echo.
echo.
echo.if %1'==' quit where are the files going?
for /D %%F in (*) do xcopy %%F\T*.* %1 /D
echo.
echo Thank you for playing

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |