15
Oct
09

getting a basename from a path using ant



If you have a path written in a file, and you’d like to get a basename from it, like in the following example:

/this/is/my/path.txt

after you run this target, you will have only path.txt. Here’s the code that makes that possible:


<target name="rgx" description="basename equivalent">
	<replaceregexp file="a.txt" match="(.*/)|(.*\\)" replace="" byline="true"/>
</target>

Advertisements

0 Responses to “getting a basename from a path using ant”



  1. Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Blog Stats

  • 228,134 hits

%d bloggers like this: