Jump to content

Trying to create a Java program to delete a folder

5tephenm1o5
Go to solution Solved by Tigerbomb8,

i have some thing but i can only get it to delete specific files i wanna delete a folder

 

to be a bit more clear it works on directories but only when they are empty

    import java.io.File;public class Delete {  public static void main(String[] args) {	    String fileName = "this is where i wanna put the folder location";	    File f = new File(fileName);	    boolean success = f.delete();	    if (!success)	      throw new IllegalArgumentException("Delete: deletion failed");	  }} 

sorry if its annoying to read i dont really like to use comments

i7-4930k   3xEvga gtx 780OC DC2 3gb    32gb corsair vengeance 2133mhz    asus rampage 4 extreme black  ~2 tb of ssd space

 my speedtest 1932mbit down / 497mbit up  custom water cooled

 

Link to comment
Share on other sites

Link to post
Share on other sites

CPU: i7 4770k | GPU: Sapphire 290 Tri-X OC | RAM: Corsair Vengeance LP 2x8GB | MTB: GA-Z87X-UD5HCOOLER: Noctua NH-D14 | PSU: Corsair 760i | CASE: Corsair 550D | DISPLAY:  BenQ XL2420TE


Firestrike scores - Graphics: 10781 Physics: 9448 Combined: 4289


"Nvidia, Fuck you" - Linus Torvald

Link to comment
Share on other sites

Link to post
Share on other sites

thank you but i cant figure out how to run it i keep getting error ive never found out how to run some thing that i didnt create so names match

i7-4930k   3xEvga gtx 780OC DC2 3gb    32gb corsair vengeance 2133mhz    asus rampage 4 extreme black  ~2 tb of ssd space

 my speedtest 1932mbit down / 497mbit up  custom water cooled

 

Link to comment
Share on other sites

Link to post
Share on other sites

and ur profile pic is my background pic its awesome

i7-4930k   3xEvga gtx 780OC DC2 3gb    32gb corsair vengeance 2133mhz    asus rampage 4 extreme black  ~2 tb of ssd space

 my speedtest 1932mbit down / 497mbit up  custom water cooled

 

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×