2012-05-16 81 views
0

我有这个蚂蚁说要复制cgi-dir到cgi-dest。如何使ANT中的<exec“cp”排除.svn文件?

<exec executable="cp" failonerror="yes"> 
     <arg value="-a" /> 
     <arg value="${cgi-dir}" /> 
     <arg value="${cgi-dest}" /> 
    </exec> 

我在“copy”ant任务中选择了这种方法,因为我想保留权限。蚂蚁任务显然不能。

问题是它复制了它看到的所有.svn目录,我该如何防止它?

+0

是不是'-p'的权限? '-a'表示全部,并找到所有文件/目录,甚至以'.'开头。祝你好运。 – shellter

+0

谢谢,但我的意思是权限作为使用而不是

+0

的原因,我的意思是'-a'选项(至少对于一个典型的linux/unix系统)被设计为查找类似'.svn *'的文件。你认为'ant cp'任务的功能是不同的吗?祝你好运。 – shellter

回答

2

那么..你可以看看here,herehere

这工作,我想:tar --exclude='.svn' -c -f - /path/to/sourcedir/* | (cd /path/to/destdir ; tar xfp -)

PS:这些现有的答案会自动显示为下右侧“相关”建议,也当你键入符合您的问题(看来你是Stack Exchange的新手)。

尽管如此,祝你好运。

+0

是的,但没有一个处理

+0

@JD。我现在了解你的情况。选项 - 1.使用像'tar --exclude ='这样的Unix技巧。svn'-c -f -/path/to/sourcedir/* | (cd/path/to/destdir; tar xfp - )'在那里创建一个没有特定文件的临时TAR,然后将它解压到目标 2.使用低效率的两步处理,首先使用CP,然后删除.svn我相信你已经考虑过了) 3.从这里[link](http://www.linuxquestions.org/questions/linux-software-2/copy-svn-working-dir-without-svn- hidden-dirs-and-files-620586 /)rsync -r --exclude = .svn/home/user/progname//home/user/progname.copy –

+0

另一个:使用'exec'中的'DOS XCOPY' '/ EXCLUDE/O/K' –

相关问题