Usage
-
CopyFiles(DocumentConfig patterns)Copies all files that match the specified globbing patterns and/or absolute paths. This allows you to specify different patterns and/or paths depending on the input document. When this constructor is used, the module is evaluated once for every input document, which may result in copying the same file more than once (and may also result in IO conflicts since copying is typically done in parallel). It is recommended you only specify a function-based source path if there will be no overlap between the path returned from each input document.
patternsA delegate that returns one or more globbing patterns and/or absolute paths.
-
CopyFiles(params string[] patterns)Copies all files that match the specified globbing patterns and/or absolute paths. When this constructor is used, the module is evaluated only once against empty input document. This makes it possible to string multiple CopyFiles modules together in one pipeline. Keep in mind that the result of the whole pipeline in this case will be documents representing the files copied only by the last CopyFiles module in the pipeline (since the output documents of the previous CopyFiles modules will have been consumed by the last one).
patternsThe globbing patterns and/or absolute paths to read.
Fluent Methods
Chain these methods together after the constructor to modify behavior.
-
To(Func<IFile, FilePath> destinationPath)Specifies an alternate destination path for each file (by default files are copied to their same relative path in the output directory). The output of the function should be the full file path (including file name) of the destination file. If the delegate returns
nullfor a particular file, that file will not be copied.destinationPathA delegate that specifies an alternate destination. The parameter contains the source
Wyam.Common.IO.IFile.
-
To(Func<IFile, IFile, FilePath> destinationPath)Specifies an alternate destination path for each file (by default files are copied to their same relative path in the output directory). The output of the function should be the full file path (including file name) of the destination file. If the delegate returns
nullfor a particular file, that file will not be copied. This overload allows you to view theWyam.Common.IO.IFilewhere the module would normally have copied the file to and then manipulate it (or not) as appropriate.destinationPathA delegate that specifies an alternate destination. The first parameter contains the source
Wyam.Common.IO.IFileand the second contains anWyam.Common.IO.IFilerepresenting the calculated destination.
-
Where(Func<IFile, bool> predicate)Specifies a predicate that must be satisfied for the file to be copied.
predicateA predicate that returns
trueif the file should be copied.
Output Metadata
The metadata values listed below apply to individual documents and are created and set by the module as indicated in their descriptions.
-
Keys.DestinationFilePath:Wyam.Common.IO.FilePathThe full path (including file name) of the destination file.
-
Keys.SourceFilePath:Wyam.Common.IO.FilePathThe full path (including file name) of the source file.
