Win a copy of High Performance Python for Data Analytics this week in the Python forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
  • salvin francis
  • Frits Walraven
  • Piet Souris

unable to traverse directory recursevely and to create soft-link !!!

Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Hi all,
I am developing a simple command line app which will search for multiples copies of a file in provided directory and will replace the copies by creating a softlinks and deletes the duplicate file.
i am doing this by recursively traveling every directory provided and matching the files in subdirectories.

the worst part is that when i use GNU compiler (gcj) the code is working properly i.e it is traversing every sub-directory properly, but when i am using sun's 'javac 1.6.0_26' the program is skipping many subdirectories.
now i m using Process , Runtime classes and getRuntime() method to execute "ln -s" linux command to create soft link and passing trgt and sftlnk as argument , this too is not working ( not working on both compiler)
then i used java 1.7.0 through which i was able to create soft-link but again the program is skipping many subdirectories , therefore many files are also skipped.

please have a look on the code :- ( javac 1.6.0_26)

code for javac 1.7.0 :-


please point out my mistakes ... thanks in advance
Posts: 3036
Mac IntelliJ IDE Python VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Mac, and welcome to the Ranch!

My first suggestion is to use code tags. I've added them to your post to make it easier to read. My second suggestion is to post less code. A lot of times, people who could answer your question get put off by seeing 100s of lines of code and just go on to the next question.

In this case, I assume you're running into trouble with recursiveTraversal(), but I don't see anything obviously wrong with it. I'd try breaking that code out and maybe using it to print out a tree structure of your folder. The subdirectories it's missing ... are they always the same ones? What distinguishes those from the ones it does find? If that doesn't make the problem pop out for you, at least you'd have more targeted information to bring back here.
I've got no option but to sell you all for scientific experiments. Or a tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic