Searching directory (NOT: file) patterns with XCOPY ????

Searching directory (NOT: file) patterns with XCOPY ????

Post by Tom Mill » Tue, 19 Aug 2003 15:54:45

Ok, if I want to copy all files in the directory tree containing *.log in the filename
I could write something like

XCOPY D:\*.log ...... D:\targetdir

But how do I specify if I want to copy all DIRECTORIES which contain the pattern "log"
to the targetdir ?

XCOPY D:\*log*\*.* ..... D:\targetdir

doesn't work. At least it would help if I could specify that only the LAST part of the path
is "log". In other words that log does not appear inside the path. Thus files in dirs like
D:\project1\part1\log\myfile.txt          should be copied at least
D:\project2\logs\part2\myfile2.txt        should be copy too only if possible

Is this possible with XCOPY or a "tricky" workaround ?



1. produce list of files in current directory matching pattern

I would like a macro to product a list of the files in the current
directory that match a specified pattern.  For example, I want a list
of the files that match the pattern (*.cpp *.c *.h).  I thought I could
use %Expand[*.cpp *.c *.h], but it just returns the string "*.cpp *.c
*.h", not the actual filenames (without path, of course).  Can this be
done simply?

If not, I would settle for a macro that would return "*.cpp *.h" if
there were .cpp and .h files in my directory but no .c files.  In fact,
that might be better, but either way is good.  But it really needs to
be a simple macro that can be used as part of an alias, not via a batch
file if possible.

Sent via
Before you buy.

2. SYS-2-MALLOCFAIL error on a cisco 4700

3. How to show all files in multiple directory trees with a certain pattern?

4. Shared library - Sample code anyone?

5. TC32: Possible to MOVE a directory (as a unit, not doing it file by file)

6. Cablesoft -Infrasture Modelling software

7. Need: Recursive directory search of all files for specified text

8. Proposed State & Federal Regulations for the INTERNET!

9. Recursive directory search of all files for specified text

10. DOS file search program that searches all drives

11. "Pattern" sources not compiled in libgrx20.a

12. "Too many files, directory not sorted"

13. Question: file not found, cannot copy, cannot make directory