• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how to find the intermediate directory

 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
mythily prakash
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.


 
reply
    Bookmark Topic Watch Topic
  • New Topic