Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8858711
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T14:53:25+00:00 2026-06-14T14:53:25+00:00

How to delete folder(contain some folder and file) from internal storage? Folder have some

  • 0

How to delete folder(contain some folder and file) from internal storage? Folder have some below tree.

folder
|_________  C2 (folder)
             |________1 (folder)
                      |________1.gif
                      |________2.gif
                      |________3.gif
                      |________4.gif
             |________2 (folder)
                      |________1.gif
                      |________2.gif
                      |________3.gif
                      |________4.gif
             |________3 (folder)
                      |________1.gif
                      |________2.gif
                      |________3.gif
                      |________4.gif
             |________4 (folder)
                      |________1.gif
                      |________2.gif
                      |________3.gif
                      |________4.gif
             |________5 (folder)
                      |________1.gif
                      |________2.gif
                      |________3.gif
                      |________4.gif

|_________  C2.xml (file)

I want to delete folder and containing all files

fil.delete();

System.out.println("boolean =>" + fil.delete());

but above code shows false. Please help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T14:53:26+00:00Added an answer on June 14, 2026 at 2:53 pm

    Check this out.

    public void deleteRecursive(File fileOrDirectory) {
    
       if (fileOrDirectory.isDirectory()) {
           for (File child : fileOrDirectory.listFiles()) {
              deleteRecursive(child);
           }
       }
    
       fileOrDirectory.delete();
     }
    

    for explaination How to delete a whole folder and content?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have to delete folder with more than 30000 images. I have '.nomedia' file
I want to delete a file in assets folder in run-time. I have a
I have a folder that will contain a temporary file that will be created
The folder I need to delete is one that is created from my program.
I need to delete a picture from a folder where pictures are stored. For
I am running an Ant command like: <delete dir=/some/folder/path//> The folder /path/ contains some
The following is what i have when i try to delete a folder: namespace
I have a folder with sub-folders, each can contain more sub-folders and so on.
Sometimes I can't delete a folder, because it contains thumbs.db . I have a
I have a folder which contains some subversion revision checkouts (these are checked out

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.