Search code examples
batch-filecopynantxcopy

NANT copy all files with similar name


I am converting an existing batch script into a nant script.

the batch file originally made this call, which appears to copy all files with the same prefix to a directory.

xcopy /y /s "paths\name*.exe" Directory\

I know how to copy a folder tree in nant, but this is different. Is there a way to do this?


Solution

  • Ok, I figured it out. I used this:

    <copy todir="target\similars" >
        <fileset basedir="source\similars">
            <include name="similar*.txt" />
        </fileset>
    </copy>
    

    The wildcard * in the include element is what lets me specify differences in the filenames.