aspose file tools
The moose likes Java in General and the fly likes Delete A Directory Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "Delete A Directory" Watch "Delete A Directory" New topic
Author

Delete A Directory

satya satish
Ranch Hand

Joined: Oct 20, 2008
Posts: 41
Hi all,
I am trying to delete a diretory (Files) using java and it is working when i run the respective .class by keeping it out of directory.
But if i keep the .class in the same directory where i am trying to delete , there then it is deleting all other files except the .class and therefore the directory remains as it is.

It will be great if any one could suggest this.

regards
satya
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 32833
    
    4
Did you expect to delete a directory while its contained files are in use?
satya satish
Ranch Hand

Joined: Oct 20, 2008
Posts: 41
Yes, this is for like Uninstalling a application.
satya satish
Ranch Hand

Joined: Oct 20, 2008
Posts: 41
First i created an Executable .jar file, where this will delete ( Clean ) all Files in the Directory(Application) and then finally the Directory(Application).
I placed this .jar inside the Directory, so that to uninstall this Application i click on this .jar.


Thank you
satya
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 32833
    
    4
Don't know, I am afraid.

Anybody else?
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 8566

Have you considered copying the jar to a temp location and then executing it from there? Files in the temp location get cleaned up by the OS.


[Donate a pint, save a life!] [How to ask questions] [Onff-turn it on!]
satya satish
Ranch Hand

Joined: Oct 20, 2008
Posts: 41
Yes, i tried by keeping the jar in temp location(out side of the application ) and it was deleting the Directory, but my requirement is that , the executable jar named "Uninstaller.jar" (which performs deleting the Directory) will be there inside my application under the UnInstaller Folder and it should delete entire Application when i click the uninstaller.jar.


But it is Not working, instead of that it is cleaning all files except the Uninstaller Folder as it is in Progress and so the application is not removed completely.


So any one can help me in doing this ?

thank you
Satya
satya satish
Ranch Hand

Joined: Oct 20, 2008
Posts: 41
Hi i'm waiting for a solution so if any one it will be help full.

Once Again the requirement is, Uninstalling the application using java.
satya satish
Ranch Hand

Joined: Oct 20, 2008
Posts: 41
Friends i'm using Cmdow.exe Command Line Window Utility for hiding, listing, hiding/unhidingminimizing.maximiging,enabling.disabling of Batch files (and for Other purposese also) i used this cmdow.exe in my application diirectly when installing my application . But sometimes in someother machines while it is being installing it is identified as Virus, this is Becuase the Anti Virus makers decided to destroy because of its hiding a file feature.


So i'm looking for alternate for cmdow.exe
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3268

Please use UseOneThreadPerQuestion.


Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Delete A Directory
 
Similar Threads
How to Delete a Directory
Delete file from linux/unix that has non-printable characters
how to delete files datewise..
how to delete an empty file using File.delete()
bean compilation error