February 27, 2013

Delete File in java

How to delete a file in java



package blackberry;

import java.io.*;
 
public class DeleteFile

{
 
private static void deletefile(String file)
{
 
File f1 = new File(file);

boolean success = f1.delete();

if (!success)
{
 
System.out.println("Deletion failed.");

System.exit(0);
}

else
{
System.out.println("File deleted Successfully.");
}

}
 
public static void main(String[] ran)

{
 
    switch(args.length)
{
 
case 0: System.out.println("File has not mentioned.");
 
          System.exit(0);
 
case 1: deletefile(ran[0]);

         System.exit(0);
 
default : System.out.println("Multiple files are not allow.");
 
            System.exit(0);
  
 }
 
}

}

.ini file


Gutmann algorithm for secure file deletion read here

java blog

3 comments:

  1. If some one wants expert view regarding blogging and site-building then i suggest
    him/her to pay a visit this blog, Keep up the good job.


    my webpage ... studio reklamy
    My webpage: dolnoslaska agencja reklamowa

    ReplyDelete
  2. Very descriptive article, I enjoyed that a lot.
    Will there be a part 2?
    See this: wróżBy,
    http://horoskopdlaciebie.com.pl

    ReplyDelete
  3. I must thank you for the efforts you have put in writing this blog.

    I am hoping to check out the same high-grade blog posts from
    you in the future as well. In truth, your creative writing abilities has encouraged me
    to get my own, personal website now ;)

    my blog post; grupa kreatywna

    ReplyDelete

Your feedback may help others !!!

Facebook comments