Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6641727
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T23:50:42+00:00 2026-05-25T23:50:42+00:00

I need a symbolic link selector in Apache Ant. The following selectors are available

  • 0

I need a symbolic link selector in Apache Ant.

The following selectors are available to the Core.

Can anyone advise me on writing a <scriptselector> for selecting only the symbolic linked files under a directory? Or any other way?

The reason:

folder
|-- file-0.0.1
|-- file-0.0.2
|-- file-0.0.3
`-- file --> file-0.0.3

I just want to get the file that is symbolically linked by file. In this case file-0.0.3, but the symbolic link can change and I don’t want all the other files to be in the Ant <fileset>

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T23:50:43+00:00Added an answer on May 25, 2026 at 11:50 pm

    Please take a look at :

    http://ant.apache.org/manual/Tasks/symlink.html

    I don’t have a linux machine to test now but I guess that with the something like this :

    <symlink action="record" linkfilename="my.links">
     <fileset dir="${my.folder}" includes="*"/>
    </symlink>
    

    You should be able to record your symlinks into a file and then processing the files as you wish. For example you could then create a list only with the “symlinked” files and iterate over it to do what you want.

    EDIT :

    For this solution you will need to install the ant-contrib. Just unpack the ant-contrib-1.0b3.jar to your ant/lib directory. Then use the following build.xml file :

    <project name="test" default="build">
      <!--Needed for antcontrib-->
      <taskdef resource="net/sf/antcontrib/antcontrib.properties"/>
      <target name="build">
      <property name="my.dir" value="/home/stefanos"/>
      <exec executable="bash" outputproperty="symlinks" dir="${my.dir}">
         <arg value="-c"/>
         <arg value="\ls -1 | xargs -l readlink"/>
      </exec>
    
    <foreach list="${symlinks}" delimiter="${line.separator}" param="link" target="process.link"/>    
    
    </target>
    
    <target name="process.link">
       <!--Do whatever you want with the file targeted by the symlink-->
       <echo message="Processing link : ${link}"/>
    </target>
    </project>
    

    The trick is the linux command which returns all the targeted files from the symlinks. Then you just iterate through them with the foreach task and you call a target in which you can do whatever you need with the files.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a /usr/lib/libtiff.so.3 as a symbolic link to /usr/lib/i386-linux-gnu/libtiff.so.4.3.3 . I need to
I need to create a symbolic link mysite.com to point to a directory /home/drupal/sites/mysite
I need to create a Junction point (directory symbolic link) from C:\x to C:\xxx\yyy\zzz\aaa\bbb
I need to create the following symbolic links into RPM file /bin/ln -sf libcrypto.so.0.9.8e
Need to locate the following pattern: The letter I followed by a space then
I want to set up a symbolic link from my svn to the /var/www
Ok, I am trying to create a symbolic link using php symlink() function, but
Windows 6 (Vista and Server 2008) support proper symbolic links, which can be created
I often need to check if expr1==expr2 , where checking for symbolic equality is
On Server Fault, How to list symbolic link chains? (not my question) talks about

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.