ant中copy操作学习心得

洛谷 P5736 【深基7.例2】质数筛 题目描述 输入 n(n\le100)n(n≤100) 个不大于 100000 的整数。要求全部储存在数组中,去除掉不是质数的数字,依次输出剩余的质数。 输入格式 无 输出格式 无 输入输出样例 输入 #1 复制 5 3 4 5 6 7 输出 #1 复制 3 5 7 板子题,使用一下线性筛 #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> using n 阅读详情

[轉載]ant中copy操作学习心得

 

Ant真是太方便了,以前都没注意到它。功能很强大,能创建数据库,配置服务器,部署发布应用……只需要写好build.xml文件,剩下的就交给ant来“安装”你的WEB应用了。

Appfuse的第一个ant命令是ant new,其任务是建立一个新命名的project,少不了会复制很多文件。build.xml中也有很多copy操作,为了搞清楚ant new到底干了些什么事,还是先把copy操作了解一下。看了会ant的DOCS,网上也找了些文章,发现copy这部分都是一带而过,讲得很浅,于是我就只有自己实验下,发现还有点收获。 ant版本为1.6.5。

1. 拷贝单个文件到指定目录下。
例:<copy todir="${basedir}/new" file="${basedir}/old/old1.txt1">
将${basedir}/old/old.txt文件拷贝到${basedir}/new下

2. 拷贝一批文件到指定目录下
例:<copy todir="${basedir}/new">
           <fileset dir="${basedir}/old">
              <include name="old1.txt" />
              <include name="old2.txt" />
              <exclude name="old8.txt" />
          </fileset>
       </copy>
      这里fileset定义的是原文件的组成形式,<include/>子属性表示包括,<exclude/>子属性表示排除,很简单,通过他们组合实现多文件的筛选,当然我这个例子用得很傻。比如
                <include name="appgen/**"/>
                <include name="ibatis/**"/>
                <exclude name="**/*.log"/>
      拷贝appget目录和ibatis目录下除了.log文件以外的其它所有文件和子目录。

      可以把<fileset/>简写成<fileset dir="${basedir}/old" includes="old1.txt,old2.txt" />,includes可以理解成include的复数形式,包含多个文件时用逗号隔开,excludes也一样。

3. 拷贝一个目录到指定目录下
例:<copy todir="${basedir}/new">
           <fileset dir="${basedir}/old">
             <include name="appgen" />
             <include name="appgen/" />
             <include name=appgen/**" />
             <include name="appgen/***" />
           </fileset>
       </copy>
      同样使用<fileset/>属性,name指定目录名,不过这里要分两种情况,用<include/>子属性和不用<include/>子属性.
      若使用<include/>, 又要分三种情况
          若是“appgen”,则只会拷贝名为appgen的空目录过去,它里面的文件和子目录则不会拷贝。
          若是“appgen/”,或“appgen/**”,则会把整个appgen目录拷贝过去,包括里面的文件和子目录。
          若是“appgen/*”,则只会把该目录和该目录下第一级子目录的所有东西拷贝过去,而不会拷贝第二级和第二级以下的。注:“appgen/*”这儿是一个*号,*号若大于两个,也跟一个*号是同样效果。比如“appgen/*”和“appgen/****”都只拷贝appgen目录下第一级子目录。

注:若appeng这个目录本身就是个空目录,无论怎么写,这个空目录都不会被拷贝。也就是说,copy操作不会产生创建空目录的作用,要想创建空目录,只有用mkdir。

      若不使用任何<include>属性,如
           <fileset dir="${basedir}/old">
           </fileset>
      则会拷贝${basedir}/old下的所有文件和子目录。

注:使用<exclude/>排除目录时,目录名必须写成“appgen/”或“appgen/**”形式,否则不会生效。

      以上是三种拷贝到目录的种类,注意如果计算机中没有todir指定的路径,ant将会自动创建这个路径。

4. 拷贝单个的文件:
〈copy tofile="old.txt" file="new.txt" /〉就这么简单就行了。
当然也可以写成
  <copy tofile="${basedir}/new/new.txt">
     <fileset dir="${basedir}/old" includes="old.txt" />
  </copy>
      这里includes就只能写一个文件,不能写上多个文件,因为不能将多个文件复制到一个文件中去,所以这样麻烦的写法是没有意义的。



      复制肯定还要涉及到同名覆盖的问题,ant在copy类的API中说明:Files are only copied if the source file is newer than the destination file,这里的newer是指文件的修改时间,即使你在修改时文件内容没有任何变化,只是导致修改时间变了,ant同样会覆盖同名文件,也就是说,ant不会检查文件内容。

      对于是复制目录的情况,由于目录没有修改时间,ant还是通过检查目录内文件的修改时间来决定是否覆盖的,若目录内某文件修改时间有变化,则会覆盖这个文件,而不是整个目录。

如果要强行覆盖,<copy/>有个overwrite属性,默认为false,改成true就行了。

YOLOv11【第三章:高阶应用与落地篇·第7节】多任务联合训练(Multi-Task Learning):检测+分割+关键点三头并进! 🏆 本文收录于专栏 《YOLOv11实战:从入门到深度优化》。本专栏围绕 YOLOv11 的改进、训练、部署与工程优化 展开,系统梳理并复现当前主流的 YOLOv11 实战案例与优化方案,内容目前已覆盖 分类、检测、分割、追踪、关键点、OBB 检测 等多个方向。 阅读详情

相关推荐

AD20/Altium designer——元器件批量命名与编号的高效技巧

本文详细介绍了在AD20/Altium Designer中实现元器件批量命名与编号的高效技巧。通过解析核心的“原理图标注”功能,从基础全局操作到进阶的按模块分区、利用标识符及合并BOM等智能方法,帮助硬件工程师彻底告别手动编号,大幅提升设计效率与文档规范性,并融入了一套完整的实战工作流。

whisky的博客 578

Ant类型之FileSet

FileSet是一组文件,是从基本目录开始的目录树中与一系列模式集和选择器的模式匹配的文件。模式集可以通过内嵌patternset元素设置,此外,文件集还包含了一个隐式的模式,并支持内嵌include、includesfile、exclude、excludesfile元素,以及模式集的属性。选择器作为FileSet的内嵌元素使用。如果文件集中的任何选择器都没有选择一个文件,那么这个文件就不会包含在文件集中。

荣耀之路 4502

Sciter教程_00_创建HelloWorld工程

本教程记录Sciter工程的创建和编译运行的过程。

qq_36707072的博客 2285

ant的FileSet资源集合

ant的FileSet资源集合

听海边涛声 301

Aloudata 荣登“数智技术系列榜单”和“数据智能服务商 TOP30”

持续助力各行业数智化先进企业突破数据管理技术瓶颈,以更加敏捷、精准和可靠的数据交付驱动企业业务创新与经营提效

Aloudata的博客 680

CAN总线错误帧全解析:从数据包到硬件层的故障树分析

本文深入解析CAN总线错误帧的故障树分析方法,从数据包到硬件层全面剖析错误机制。通过物理层信号测试、数据链路层错误解码和应用层协议排查,提供系统化的诊断框架。结合CANoe配置和示波器波形分析,帮助工程师快速定位总线故障,提升系统可靠性。

weixin_26742753的博客 510

fileset用法

FileSet    FileSet是一个文件组.这些文件可在以根目录开始的目录树里找到,符合PatternSet和Selector设定的模式. FileSet在支持这种特性的任务里出现,或者与目标同一级出现,就像项目的子元素.    PatternSet可以在内嵌元素&lt;patternset&gt;定义.另外,FileSet包含一个隐性PatternSet,并且直接支持PatternSet ...

2548

【逆向实战】Unity游戏资源提取与解密全攻略:从AssetBundle到libil2cpp.so的破解技巧

本文详细介绍了Unity游戏资源提取与解密的完整流程,涵盖从AssetBundle到libil2cpp.so的破解技巧。通过AssetStudio和Il2CppDumper等工具,读者可以学习如何提取未加密资源、处理加密文件,并掌握动态dump技术。文章还提供了自动化脚本编写和常见问题解决方案,帮助逆向工程爱好者高效完成资源提取任务。

weixin_29012765的博客 1066

[转]ANT中FileSet的用法

FileSet    FileSet是一个文件组.这些文件可在以根目录开始的目录树里找到,符合PatternSet和Selector设定的模式. FileSet在支持这种特性的任务里出现,或者与目标同一级出现,就像项目的子元素.    PatternSet可以在内嵌元素 &lt;patternset&gt;&lt;/patternset&gt; 定义.另外,FileSet包含一个隐性Pattern...

陈国中的专栏 853

华为昇腾910B3显卡实战:手把手教你部署DeepSeek 32B模型(含Bge-zh向量库配置)

本文详细介绍了在配备8张华为昇腾910B3显卡的服务器上,从零部署DeepSeek 32B大模型推理服务的完整实战方案。内容涵盖环境准备、模型配置、多卡负载分配,并集成了BGE中文向量模型与ChromaDB向量数据库,最终通过Open WebUI构建了可投入生产的企业级AI应用栈,为私有化大模型部署提供了具体参考。

weixin_29038345的博客 1745

ADS基础教程22 - 有限元电磁仿真(FEM)

一、引言二、FEM操作过程1.新建Layout1.新建Layout2.EM设置3.设置Frequency plan4.设置Output plan5.设置Options6.设置网格频率7.仿真结果三、总结介绍了在ADS中如何进行FEM仿真过程。END!}}END!

XZ_ZC的博客 2594

java ant copy_ant中copy操作学习心得

Ant真是太方便了,以前都没注意到它。功能很强大,能创建数据库,配置服务器,部署发布应用……只需要写好build.xml文件,剩下的就交给ant来“安装”你的WEB应用了。Appfuse的第一个ant命令是ant new,其任务是建立一个新命名的project,少不了会复制很多文件。build.xml中也有很多copy操作,为了搞清楚ant new到底干了些什么事,还是先把copy操作了解一下。看...

weixin_36174545的博客 259

WblockCloneObjects克隆一个图纸内的实体包括块参照,同名块参照的处理

public static void HeBingTu2(double lieJu, List<string> filePaths) { Document doc = Application.DocumentManager.MdiActiveDocument; Database db = doc.Database; using (DocumentLock docLock = doc.Lock...

1122

ant中copy操作学习心得(转)

Ant真是太方便了,以前都没注意到它。功能很强大,能创建数据库,配置服务器,部署发布应用……只需要写好build.xml文件,剩下的就交给ant来“安装”你的WEB应用了。Appfuse的第一个ant命令是ant new,其任务是建立一个新命名的project,少不了会复制很多文件。build.xml中也有很多copy操作,为了搞清楚ant new到底干了些什么事,还是先把copy操作了...

Zjg13835813856的博客 189

假人有限元模型

假人模型,车辆碰撞假人有限元模型,适合做乘员安全的研究者利用

数学建模模型总结

这是本人在两年内准备参加数学建模竞赛搜集到的模型资料,已经经过了本人的筛选和整理,希望能够对准备参加数学建模竞赛的学弟学妹们提供一些帮助!

ANT应用:copy操作学习心得

Ant真是太方便了,以前都没注意到它。功能很强大,能创建数据库,配置服务器,部署发布应用……只需要写好build.xml文件,剩下的就交给ant来“安装”你的WEB应用了。 Appfuse 的第一个ant命令是ant new,其任务是建立一个新命名的project,少不了会复制很多文件。build.xml中也有很多copy操作,为了搞清楚ant new到底干了些什么事,还是先把copy操作了解一下。看了会ant的DOCS,网上也找了些文章,发现copy这部分都是一带而过,讲得很浅,于是我就只有自己实验

grueclan的专栏 578

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

【转载】ant中copy操作学习心得

Ant真是太方便了,以前都没注意到它。功能很强大,能创建数据库,配置服务器,部署发布应用……只需要写好build.xml文件,剩下的就交给ant来“安装”你的WEB应用了。 Appfuse的第一个ant命令是ant new,其任务是建立一个新命名的project,少不了会复制很多文件。build.xml中也有很多copy操作,为了搞清楚ant new到底干了些什么事,还是先把copy操作了解

咖啡加醋 582

NTscan扫描工具

ntscan是一个扫描器,可以扫描没有密码和弱密码的共享,先到配置文件中填写猜测的用户名和密码,扫描过程中右侧出现的是扫描日志。

Ant操作学习心得

一本Ant详细的书:&lt;Ant开发及整合应用详解&gt; http://book.csdn.net/bookfiles/379/index.html   Ant中copy操作学习心得 Appfuse的第一个ant命令是ant new,其任务是建立一个新命名的project,少不了会复制很多文件。build.xml中也有很多copy操作,为了搞清楚ant new到底干了些什么事,还是先把c...

zengenry的专栏 180
下一篇: HttpClient请求Https协议
Johnny__Tang
博客等级 码龄18年 9粉丝 11原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值
⌂ 换网址