0

I have this ant talk to copy cgi-dir to cgi-dest.

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

I chose this method over the "copy" ant task because I wanted to preserve permissions. The ant task explicitly can't.

The problem is that it copies all the .svn directories it sees, how can I prevent this?

JD.
  • 2,361
  • 6
  • 25
  • 38
  • Isn't it `-p` for permissions? `-a` means all, and finds all file/dirs, even thous beginning with `.`. Good luck. – shellter May 16 '12 at 20:52
  • thanks, but I meant permissions as the reason im using instead of – JD. May 17 '12 at 13:56
  • my point is that the `-a` option (at least for a typical linux/unix system) is designed to find files like `.svn*`. Do you think that the `ant cp` task is designed to function differently? Good luck. – shellter May 17 '12 at 14:20

1 Answers1

2

Well.. you can look here, here or here .

This will work I think: tar --exclude='.svn' -c -f - /path/to/sourcedir/* | (cd /path/to/destdir ; tar xfp -)

PS : These existing answers automatically appear as suggestions on the right hand side under "Related" and also when you are typing the subject to your question (it appears you are new to Stack Exchange).

Nevertheless, good luck.

Community
  • 1
  • 1
Pulak Agrawal
  • 2,481
  • 4
  • 25
  • 49
  • Yes, but none of these deal with – JD. May 17 '12 at 13:52
  • @JD. I understand your situation now. Options - 1. Use a Unix trick like `tar --exclude='.svn' -c -f - /path/to/sourcedir/* | (cd /path/to/destdir ; tar xfp -)` where you create a temp TAR without specific files and then UNTAR it to the destination 2. Use a inefficient two step process with first using CP and then delete .svn (I am sure you have already thought about this) 3.From here [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 – Pulak Agrawal May 18 '12 at 08:29
  • One more : Use `DOS XCOPY` from within `exec` with `/EXCLUDE /O/K` – Pulak Agrawal May 18 '12 at 08:31
  • @JD did this solve your problem. If yes, can you please mark this as the correct answer :) – Pulak Agrawal Jun 27 '12 at 02:15