You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Eric Wood <EW...@llbean.com> on 2006/05/01 20:22:46 UTC

Problems with exec

As the on-line documentation suggests, I am using exec to copy some
files on UNIX to preserve permissions, but exec is taking my wildcard as
translating it as a literial.

I'm attemping to copy all files in a subdirectory to another directory
using:
      cp -R * destinationDir

But the exec command seems to be quoting my * (wildcard) and returning
the following error:
     [exec] cp: *: A file or directory in the path name does not exist.
     [exec] Result: 1

Here is my exec command:
      <exec executable="/usr/bin/cp" >
          <arg line="-R * ${dir.deploy.tgt}"/>
      </exec>

How can I get around this?

Eric

Re: Problems with exec

Posted by "Scot P. Floess" <fl...@mindspring.com>.
Nice use of bash :)

Something also to remember, when executing commands in a shell, the 
shell does expansion for you.  So, the fact that you would use a * in 
your command doesnt necessarily mean the command is interpreting the *.

Tommy Nordgren wrote:
>
> On 1 maj 2006, at 20.22, Eric Wood wrote:
>
>> As the on-line documentation suggests, I am using exec to copy some
>> files on UNIX to preserve permissions, but exec is taking my wildcard as
>> translating it as a literial.
>>
>> I'm attemping to copy all files in a subdirectory to another directory
>> using:
>>       cp -R * destinationDir
>>
>> But the exec command seems to be quoting my * (wildcard) and returning
>> the following error:
>>      [exec] cp: *: A file or directory in the path name does not exist.
>>      [exec] Result: 1
>>
>> Here is my exec command:
>>       <exec executable="/usr/bin/cp" >
>>           <arg line="-R * ${dir.deploy.tgt}"/>
>>       </exec>
>>
>> How can I get around this?
>>
>> Eric
>     By execing a shell, (shell dependent) , passing a string to be 
> evaluated by the shell.
> With bash, the syntax is:
>     <exec executable="/bin/bash">
>         <arg value="-c"/>
>         <arg value="/usr/bin/cp * ${dir.deploy.tgt}"/>
>     </exec>
> ------------------------------------------------------
> "Home is not where you are born, but where your heart finds peace" -
> Tommy Nordgren, "The dying old crone"
> tommy.nordgren@chello.se
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>

-- 
Scot P. Floess
27 Lake Royale
Louisburg, NC  27549

252-478-8087 (Home)
919-754-4592 (Work)

Chief Architect JPlate  http://sourceforge.net/projects/jplate
Chief Architect JavaPIM http://sourceforge.net/projects/javapim


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


Re: Problems with exec

Posted by "Alexey N. Solofnenko" <A....@mdl.com>.
"*" is understood only by shell. I guess you would want to add "-u" 
option (and maybe "-p") in addition to -R. Also it maybe better to run 
rsync (or unison) - they can delete obsolete files.

- Alexey.

Tommy Nordgren wrote:
>
> On 1 maj 2006, at 20.22, Eric Wood wrote:
>
>> As the on-line documentation suggests, I am using exec to copy some
>> files on UNIX to preserve permissions, but exec is taking my wildcard as
>> translating it as a literial.
>>
>> I'm attemping to copy all files in a subdirectory to another directory
>> using:
>>       cp -R * destinationDir
>>
>> But the exec command seems to be quoting my * (wildcard) and returning
>> the following error:
>>      [exec] cp: *: A file or directory in the path name does not exist.
>>      [exec] Result: 1
>>
>> Here is my exec command:
>>       <exec executable="/usr/bin/cp" >
>>           <arg line="-R * ${dir.deploy.tgt}"/>
>>       </exec>
>>
>> How can I get around this?
>>
>> Eric
>     By execing a shell, (shell dependent) , passing a string to be 
> evaluated by the shell.
> With bash, the syntax is:
>     <exec executable="/bin/bash">
>         <arg value="-c"/>
>         <arg value="/usr/bin/cp * ${dir.deploy.tgt}"/>
>     </exec>
> ------------------------------------------------------
> "Home is not where you are born, but where your heart finds peace" -
> Tommy Nordgren, "The dying old crone"
> tommy.nordgren@chello.se
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org

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


Re: Problems with exec

Posted by Tommy Nordgren <to...@chello.se>.
On 1 maj 2006, at 20.22, Eric Wood wrote:

> As the on-line documentation suggests, I am using exec to copy some
> files on UNIX to preserve permissions, but exec is taking my  
> wildcard as
> translating it as a literial.
>
> I'm attemping to copy all files in a subdirectory to another directory
> using:
>       cp -R * destinationDir
>
> But the exec command seems to be quoting my * (wildcard) and returning
> the following error:
>      [exec] cp: *: A file or directory in the path name does not  
> exist.
>      [exec] Result: 1
>
> Here is my exec command:
>       <exec executable="/usr/bin/cp" >
>           <arg line="-R * ${dir.deploy.tgt}"/>
>       </exec>
>
> How can I get around this?
>
> Eric
	By execing a shell, (shell dependent) , passing a string to be  
evaluated by the shell.
With bash, the syntax is:
	<exec executable="/bin/bash">
		<arg value="-c"/>
		<arg value="/usr/bin/cp * ${dir.deploy.tgt}"/>
	</exec>
------------------------------------------------------
"Home is not where you are born, but where your heart finds peace" -
Tommy Nordgren, "The dying old crone"
tommy.nordgren@chello.se



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