SageTV Community  

Go Back   SageTV Community > SageTV Development and Customizations > SageTV Studio
Forum Rules FAQs Community Downloads Today's Posts Search

Notices

SageTV Studio Discussion related to the SageTV Studio application produced by SageTV. Questions, issues, problems, suggestions, etc. relating to the Studio software application should be posted here.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 10-15-2009, 01:57 PM
PLUCKYHD PLUCKYHD is offline
SageTVaholic
 
Join Date: Dec 2007
Posts: 6,257
Delete a Folder in Java

Is there a way to Delete A Folder and all of it's subfolders and contents in java without having to call though every content of the folder and deleting them one at a time.

I tried

Folder.delete();

but the folder contents have to be empty for that to work.

TIA
Reply With Quote
  #2  
Old 10-15-2009, 01:58 PM
PLUCKYHD PLUCKYHD is offline
SageTVaholic
 
Join Date: Dec 2007
Posts: 6,257
I found this but it doesn't seem to work either not sure why seems like it would

Code:
public static void delete(File folder)
{
        if(folder.exists())
        {
                File[] files = folder.listFiles();
                for(int nFileCur=0; nFileCur < files .length; nFileCur++)
                {
                        File oFileCur = files [nFileCur];
                        if(oFileCur.isDirectory())
                        {
                                // call itself to delete the contents of the current folder
                                delete(oFileCur);
                        }
                        oFileCur.delete();
                }
        }
}
Reply With Quote
  #3  
Old 10-15-2009, 02:10 PM
PLUCKYHD PLUCKYHD is offline
SageTVaholic
 
Join Date: Dec 2007
Posts: 6,257
NeverMind Got it sorry for wasting anyones time
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
SageMC - Delete DVD folder dlandrum SageMC Custom Interface 10 07-04-2009 11:50 AM
How to delete a video folder ? rv73 SageTV Software 1 03-26-2008 12:55 PM
How to delete multiple recordings or set it to auto delete? batigol9 SageTV Software 24 11-10-2006 07:57 PM
What is the errant folder for, can i delete its contents?! jimbobuk SageTV Software 1 05-12-2003 02:43 PM
Beta V1.2.2 Java java.lang Null Pointer Exception hamptonhills SageTV Beta Test Software 1 03-27-2003 12:11 PM


All times are GMT -6. The time now is 06:06 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2023, vBulletin Solutions Inc.
Copyright 2003-2005 SageTV, LLC. All rights reserved.