hi, I want to get a class file which is stored in one location like "C:/m1/m2/m3/m4/m5/.../m10/stcm.class" and i stord my java source file in another location called "C:/m1/m2/m3/m3/StringComparison/m4/m5.../m10/stcm.java".I want to copy the class file and source file to other location called " C:/m1/m2/". This is my case and know the location of class file exactly and in case of java file i dont know the intermediate dir ../StringComparison/... and it is not a staic one.According to the filename it will change,that is, if my clas name is "lemd" then the dir name is "LengthMethod". Pls help me to get it.Very Urgent.
Sounds like you will have to search for the files you want to move. Have you done recursive directory searching with File.list()? You could write your own getFullPath method that finds a given file:
fullPath = getFullPathFor( "name.ext" );
If you're going to do a lot of these, you might want to find all files in the directory and keep their paths in a Map. As long as the "name.ext" names are unique you could use the map to get the full path very quickly.
Are you comfortable with File? With Recursion? With Maps? If not, ask about the confusing bits. If this sounds like a good direction, see how much you can get working and show us what you make! [ March 13, 2006: Message edited by: Stan James ]
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
posted 13 years ago
hi folks, I got the way at last.Thanks to my guide Mr.srinivas. Here dir is the location of the source file and all the files inseide this are listed,then it will be attached to the remaining things u know and will check whether it exists or not.
Best Regards,<br />Mythily.S<br />9886530336
WHAT is your favorite color? Blue, no yellow, ahhhhhhh! Tiny ad:
how do I do my own kindle-like thing - without amazon