How to recursively copy files in MSBuild, *Where files to copy are specified on some file.txt* -
I read a list of files from a file. I want to copy and maintain their folder structure - seen in the file name (backslash or the presence of the lash on the front), how do you do it? In short, you do not have metadata which you will get if you get the filename using the wildcard. These options do not work for me because I am copying my files from a file.
For example in files.txt
folder // test1.txt
folder / subfolder / subfolder / test 1.txt / folder / subfolder / test 2 .txt
So how do I copy these files without the success of an output file?
You have one file per line, I think this is the source file, and the destination base directory somewhere else To be specified? I think //
is not important, but it indicates that it may be due to the paste paths together.
First of all, you can read the data using data. You will populate an item list with each item per line. To get started,
& lt; Target name = "microscopy" & gt; & Lt; ReadLinesFromFile file = "files.txt" & gt; & Lt; Output Task parameter = "Lines" item name = "file system" /> & Lt; / ReadLinesFromFile & gt; ⋮
Now I'm guessing that these lines are relative to the source of the source and you also give an inherent route, such as a command-line copy, Code> FileItem , and the destination is $ (destI) \% (FileItem.Identity)
. copy% (fileItem.Identity) gives a command-line copy (or xcopy?) Of $ (destIntem.Identity)
which Can be used with the Exec
function, because the copy
function does not like the available parameters, but prefer the cmd.exe copy internally to them.
Note that I have used syntax for an element in the item list, so the work in which the batch itself will be done. I think you will get the following results:
⋮ < Exec Command = "copy & amp; quot; @ (fileItem) & amp; quot; & amp; quot; $ (dest) \% (identity) & amp; quot;" / & gt;
That is, the presence of a list will repeat the whole line, and the attribute syntax refers to the same current moving item. I have not tried that line, so it can not be alright with the use of message
with the same string as what you are seeing.
Now, do I have the planet and the source material relationship as I thought? If not enough, then you need to clarify the system more accurately, and then instead of the simple combination of the string, you should write as $ (dest) \% (identity)
. String manipulation is possible using CRR system. String functions, and underlying [MSBuild] ::
property work, and other sections of CLR where you can pass the parameters right. If it is more complex than that, you can use one and write a piece in C # or VB.
Comments
Post a Comment