Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Recursive call problem

 
P Igor
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a code to go inside the subfloder to delete files before deleting the folder. For some strange reason, the code is not recursing.



The code goes to 'if' statement after hitting deleteFiles(temp, days); instead of starting from first line of deleteFiles().

btw, does anyone has the code to delete folder & it's subfolders (after deleting the files in them)?

Any thoughts??
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
[PI]: The code goes to 'if' statement after hitting deleteFiles(temp, days); instead of starting from first line of deleteFiles().

But the first line of deleteFiles() is an if statement - if we ignore the comment, anyway. Which of the many if statements are you talking about? I suspect you need to add some more logging statements, just for debugging, to find out exactly what is happening here. Or run it through a debugger. How do you know it's not recursing? Are you sure that the files you're trying to delete are old enough? Try running with days = 0 to be sure.

I don't see a problem with the code offhand. But one thing that looks rather strange is passing days as a String, and parsing it again and again every time you find a new file. I would convert it to a timestamp right away:

That's a minor point. Not a bug, but re-parsing it just seems so inefficient.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic