ANT - Increment file name
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Andi_Clemens
Posted On:   Monday, February 28, 2011 01:45 PM

Hi, I need to rename files according to the following schema: I have some ZIP files with content. I need to unzip them and rename all containing files, for example: ZIP1.zip: a.cod => Installer.cod b.cod => Installer-1.cod c.cod => Installer-2.cod ZIP2.zip: a.cod => Installer-3.cod b.cod => Installer-4.cod c.cod => Installer-5.cod etc... So all filenames need to have an incrementing number in them, but the first file has to be named differently. I tried the copy task with a chainedmapper (type regexp), but this doesn't help. I also tried to write the property to a file and increment it every time the ta   More>>

Hi,

I need to rename files according to the following schema:

I have some ZIP files with content. I need to unzip them and rename all containing files, for example:

ZIP1.zip:
a.cod => Installer.cod
b.cod => Installer-1.cod
c.cod => Installer-2.cod

ZIP2.zip:
a.cod => Installer-3.cod
b.cod => Installer-4.cod
c.cod => Installer-5.cod

etc...

So all filenames need to have an incrementing number in them, but the first file has to be named differently.

I tried the copy task with a chainedmapper (type regexp), but this doesn't help.
I also tried to write the property to a file and increment it every time the target is executed. For this to work correctly I would need to call my target on every copy action.

Is there any easy way to do this? If not, I guess I would just write some python script and include it with the exec task.

   <<Less
About | Sitemap | Contact