You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Knuplesch, Jürgen <Ju...@icongmbh.de> on 2007/09/11 08:00:55 UTC

AW: How to get the simple file name?

Hello,

My expirience is, that Ant always gives you the full path, without a chance to change it.
If someone shows how (you could write your own Ant-Task), I would be very intersted.

My solution is to write the full filename into a textfile and then delete the path with the replace task.
Probably you need this to write a scriptfile or sth else.

 


-- 
Jürgen Knuplesch                    www.icongmbh.de
icon Systemhaus GmbH                Tel. +49 711 806098-275
Sophienstraße 40                    
D-70178 Stuttgart                   Fax. +49 711 806098-299

Geschäftsführer: Uwe Seltmann
HRB Stuttgart 17655
USt-IdNr.: DE 811944121 
-----Ursprüngliche Nachricht-----
Von: Hans Schwaebli [mailto:hans_schwaebli@yahoo.com] 
Gesendet: Dienstag, 14. August 2007 12:12
An: user@ant.apache.org
Betreff: How to get the simple file name?

There is a task called <dirname>
   
  I would need a task which gives me just the filename. Any idea?
   
  Example:
  U:\projects\HSW_TST\src\com\haefele\hsw2\tst\abstractions\numbers\EntityForNumbers.java
   
  Now I need to extract the filename "EntityForNumbers.java".
   
  Of course these filenames are dynamical, so it should work for any full path to a file.

       
---------------------------------
Ready for the edge of your seat? Check out tonight's top picks on Yahoo! TV. 

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


RE: How to get the simple file name?

Posted by "Rebhan, Gilbert" <Gi...@huk-coburg.de>.
 
Hi,

-----Original Message-----
From: Knuplesch, Jürgen [mailto:Juergen.Knuplesch@icongmbh.de] 
Sent: Tuesday, September 11, 2007 8:01 AM
To: Ant Users List
Subject: AW: How to get the simple file name?

/*
Hello,

My expirience is, that Ant always gives you the full path, without a chance to change it.
If someone shows how (you could write your own Ant-Task), I would be very intersted.

My solution is to write the full filename into a textfile and then delete the path with the replace task.
Probably you need this to write a scriptfile or sth else.
*/

why not use <basename .../> ?

<basename property="filename" file="C:/foo/bar/EntityForNumbers.java"/>


Regards, GIlbert

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