ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matt Reason" <matt.rea...@movielink.com>
Subject Need help using exec to do "ls -rt1 | tail -1"
Date Fri, 04 Apr 2003 21:23:00 GMT

That command returns the name of the newest file in the directory.  I
want to put that string into a property.

The exec task seems to hate the fact that one of my arguments is a pipe.

Does anyone have a workaround?

I think I've tried every possible permutation of this:

<target name="getNewest">
        <exec dir="${sourcedir}" executable="ls"
outputproperty="theNewestFile">
                <!--
                <arg line="-rt1 | tail -1"/>
                -->                        
                <arg line="-rt1"/>
                <arg line="|"/>
                <arg line="tail"/>
                <arg line="-1"/>
        </exec>
        <echo message="The newest file in ${sourcedir} is:
${theNewestFile}"/>
</target>

Mime
View raw message