aspose file tools*
The moose likes Java in General and the fly likes Recursive call problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Recursive call problem" Watch "Recursive call problem" New topic
Author

Recursive call problem

P Igor
Greenhorn

Joined: Nov 20, 2006
Posts: 20
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

Joined: Jan 30, 2000
Posts: 18671
[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.


"I'm not back." - Bill Harding, Twister
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Recursive call problem
 
Similar Threads
Deleteing the directory.
Unable to Delete Folder + I can't belive i m posting this :(
File.createTempFile naming problem
I/O Question.
how to delete files datewise..