Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to rename files using ant recursively in all sub directories

Status
Not open for further replies.

hangon72

Programmer
Apr 22, 2005
2
0
0
US
Hi All, I have a requirement to change filenames and keep the extensions same, in all the subdirectories recursively for ex: I have directory structure below

dir1
test1.bak
subdir1
test1.txt
subdir2
test1.yyy

after I run the ant script I expect following:

dir1
test2.bak
subdir1
test2.txt
subdir2
test2.yyy

as you can see it changed all the file name from test1 to test2 and keep the extension the same.

I have tried different ways but I cannot acheive renaming the files and still keep the original directory structure.

Thanx for any help
 
I am facing the similar issue. I need to take off the underscores “_” from the names of a set of files. For example: from “my_First_File.java” and “my_Second_File.java”, to “myFirstFile.java” and “mySecondFile.java”.

Had you figure out how to do yours, please let me how.

Thank you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top