ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Patrick Martin <antu...@gmail.com>
Subject Copying a static list of files
Date Thu, 24 Jun 2010 15:50:23 GMT
Hello,

I want to copy a big number of files located on a remote server.
To avoid scanning the remote directory, I use a locally generated list
of absolute file names in a file called fileList.txt.

So my fileList.txt contains something like:
\\machine\share\dir1\dir2\file1.ext
\\machine\share\dir1\dir2\file with spaces.ext
\\machine\share\dir1\dir2\an other one.ext
\\machine\share\dir1\file3.ext

Now I want to copy some content of \\machine\share\dir1\dir2 in a
target folder (eg file*.ext).

I first thought of using filelist, but I get into problems with spaces
in file names.
<loadfile property="file.list" srcfile="fileList.txt">
	<filterchain>
		<!-- matching and removing prefix \\machine\share\dir1\dir2 -->
		.....
	</filterchain>
</loadfile>
<copy todir="target">
	<restrict>
		<filelist dir="\\machine\share\dir1\dir2" files="${file.list}" />
		<and>
			<or>
				<name name="${include.pattern.1}" />
				<name name="${include.pattern.2}" />
			</or>
			<not>
				<or>
					<name name="${exclude.pattern.1}" />
					<name name="${exclude.pattern.2}" />
				</or>
			</not>
		</and>
	</restrict>
</copy>

Then I tried to use the <files> resource collection with its
includesfile attribute, but I don't see how to specify the equivalent
of the <filelist> dir attribute. I even tried something with
<mappedresources>, without chance (nothing gets copied):
<copy todir="target">
	<restrict>
		<mappedresources>
			<files includesfile="fileList.txt" />
			<globmapper from="\\machine\share\dir1\dir2\*" to="*" handledirsep="true" />
		</mappedresources>
		<and>
			<or>
				<name name="${include.pattern.1}" />
				<name name="${include.pattern.2}" />
			</or>
			<not>
				<or>
					<name name="${exclude.pattern.1}" />
					<name name="${exclude.pattern.2}" />
				</or>
			</not>
		</and>
	</restrict>
</copy>

would anyone have an idea?

Thanks,

Patrick

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message