Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Mar 2008

    [j2me] Delete Folder

    Hi all,

    I own a Nokia N95 and I implemented a j2me function to delete a folder stored on the memory card (E: drive).
    In case the folder is empty, the function works.
    Otherwise, should not the folder be empty, I delete all of the files in folder and then I delete the folder itself.
    Files are correctly deleted and the directory becomes empty (if I open the memory card, I find the empty folder) but despite it, when I try to delete the folder, the following exception occurs: "Directory is not empty".

    Has anyone suggestions on how to solve this problem?
    Thanks in advance.


    String dir = "file:///E:/Dir/dir_to_delete";
    FileConnection fileToDelete = (FileConnection) Connector.open(dir ,Connector.READ_WRITE);
    if (fileToDelete.exists())
    Enumeration e = fileToDelete.list();
    form.append("allora \n");
    String file_2 = (String)e.nextElement();
    FileConnection file = (FileConnection) Connector.open(dir + "/" + file_2 ,Connector.READ_WRITE);

    form.append("Sono dentro\n");
    form.append("Elemento: " + file_2 + "\n");

    form.append("ESISTE \n");
    catch (IOException e)
    form.append("Errore : " + e.getMessage());
    Last edited by altropinto; 2008-03-29 at 12:43.

  2. #2
    Nokia Developer Champion
    Join Date
    Sep 2007

    Re: [j2me] Delete Folder

    Try to take that directory as a path and use the list() method to view its content because many times application can make file hide so check it.

    Happy Coding

Similar Threads

  1. How to delete messaging folder?
    By ninidotnet in forum Symbian Networking & Messaging (Closed)
    Replies: 2
    Last Post: 2007-01-29, 02:23
  2. Can I delete SMS entry from SENT folder
    By pankajmahto in forum PC Suite API and PC Connectivity SDK
    Replies: 1
    Last Post: 2006-10-03, 04:34
  3. Cannot delete messaging folder!
    By symsym in forum Symbian Networking & Messaging (Closed)
    Replies: 7
    Last Post: 2005-09-15, 06:48
  4. 6610 - Delete Messages In Templates Folder
    By dgrunited in forum Mobile Java General
    Replies: 0
    Last Post: 2004-10-26, 18:01
  5. can not successfully link any sample using .NET
    By lobotomat in forum Symbian Tools & SDKs
    Replies: 2
    Last Post: 2002-08-20, 00:29

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts