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

I/O Question.

 
Nabila Mohammad
Ranch Hand
Posts: 664
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi.
This is a simple program, though it looks long.
All i have done is created 2 Directories.
In the Directory1, I have created 3 files, and deleted the second directory.
I have then renamed the Directory1 and tried to Delete it after Deleting the files( as directories won't be deleted unless they are empty.
How ever, for some reason my files arent gettting deleted due to which the directory is not getting Deleted.
I am not sure where the problem.
Could it be because when I have created a file , i have created it in the Directory1 folder and not the renamed Directory.
That was just a guess.

Here is the code.
Hope some one can help me out.
Thanks.

 
Irina Goble
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Nabila Mohammad:
Could it be because when I have created a file , i have created it in the Directory1 folder and not the renamed Directory.
That was just a guess.


That is correct. To see what happens, use a print statement:

It will print the file name and the result of the delete() call. To remove files from the renamed directory, use the list() or listFiles() methods of the File class.

PS. File names can be case-sensitive.
 
Nabila Mohammad
Ranch Hand
Posts: 664
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Alot.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic