Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » how to delete a folder in workspace @ runtime?
how to delete a folder in workspace @ runtime? [message #200532] Mon, 19 March 2007 19:59 Go to next message
Eclipse UserFriend
Originally posted by: bensonc.ca.ibm.com

Hi,

i would like to remove a folder at runtime, but somehow the folder did not
get deleted, here is my code to delete the folder:

Path changePath = new Path("\\Module1\\folder");
IFile addedFile =
ResourcesPlugin.getWorkspace().getRoot().getFile(changePath) ;
addedFile.delete(IResource.FORCE, null);

can you please tell me whats wrong?
i didn't not get any exception during the deletion, and the folder is empty

Thank you very much
Re: how to delete a folder in workspace @ runtime? [message #200710 is a reply to message #200532] Tue, 20 March 2007 23:54 Go to previous message
Eclipse UserFriend
Originally posted by: simon.crossleyit.co.uk

Use IFolder rather than IFile and this works fine

IProject proj =
ResourcesPlugin.getWorkspace().getRoot().getProject("Module1 ");
proj.create(null);
proj.open(null);
IFolder fol = proj.getFolder("folder");
fol.create(true, true, null);

Path changePath = new Path("\\Module1\\folder");
IFolder addedFile =
ResourcesPlugin.getWorkspace().getRoot().getFolder(changePat h);
assertTrue(addedFile.exists());
addedFile.delete(IResource.FORCE, null);
assertFalse(addedFile.exists());


Benson wrote:
> Hi,
> i would like to remove a folder at runtime, but somehow the folder did
> not get deleted, here is my code to delete the folder:
>
> Path changePath = new Path("\\Module1\\folder");
> IFile addedFile =
> ResourcesPlugin.getWorkspace().getRoot().getFile(changePath) ;
> addedFile.delete(IResource.FORCE, null);
>
> can you please tell me whats wrong?
> i didn't not get any exception during the deletion, and the folder is empty
>
> Thank you very much
>
Previous Topic:Open files in Eclipse via CLI?
Next Topic:Accessing the actions present in the CoolBar
Goto Forum:
  


Current Time: Fri Apr 26 11:51:07 GMT 2024

Powered by FUDForum. Page generated in 0.08486 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top