Problems while copying an executable file with ANT

M

Manish Hatwalne

I am trying to copy a compiled, execuatable file from one directory to
another using ant task - copy. However, the file gets opied but its
executable attribute "X" is stripped, so the file is no more executable. How
can I preserve the file's "X" attribute?

This is what I have used on my linux box -

<copy todir="${riepath}" file="/my_source_path_here/name_of_execuatble">
</copy>

TIA,
- Manish
 
J

JavaJug

I think this is a gap in the ant tasks.
There is a <Attrib> task that allow you to change the attributes of files, but
don't delight too quick, as currently it works only under Windows.
As you talk about 'X' attribute, I assume you're not under windows...

The only solution I see for you is to execute a shell command that will change
your file's attributes after copying it/them. Hopefully, you can do that with
ant (<Apply> task).
Assuming you are under linux, the command is "chmod u+x <your new file(s)>" (or
a+x or o+x...).
Ant task :
<apply executable="chmod">
<arg value="u+x"/>
<fileset dir="<your dir (${riepath})>"/>
</apply>
will (hopefully, I'v not tested) make all files in you directory executable for
the user. If you want to do it only on certain files, you can add
includes="file1,file2,...,filen" in the <fileset>.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,044
Latest member
RonaldNen

Latest Threads

Top