Tom's Hardware > Forum > Windows 2000/NT > Windows 2000/NT General Discussion > How to delete a LAN file through java code
Word :    Username :           
 

package com;
import java.io.File;


public class Delete2 {


public static void delete(String fileName) {
try {
// Construct a File object for the file to be deleted.
File target = new File(fileName);

if (!target.exists()) {
System.err.println("File " + fileName
+ " not present to begin with!" );
return;
}

// Quick, now, delete it immediately:
if (target.delete())
System.err.println("** Deleted " + fileName + " **" );
else
System.err.println("Failed to delete " + fileName);
} catch (SecurityException e) {
System.err.println("Unable to delete " + fileName + "("
+ e.getMessage() + " )" );
}
}
public static void main(String[] argv) {
String filePath = "c:/";
String sourceFileName = "fileWrite2.txt";
String fullpath = filePath + sourceFileName ;
System.out.println(fullpath);
String filename = "c:/fileWrite2.txt";
delete(fullpath);
}}

Sponsored Links
Register or log in to remove.
Tom's Hardware > Forum > Windows 2000/NT > Windows 2000/NT General Discussion > How to delete a LAN file through java code
Go to:

There are 522 identified and unidentified users. To see the list of identified users, Click here.

Sponsored links
  • Ask the community now
  • Publish
Ad
They won a badge
Join us in greeting them
  • 01:00 sighQ2 won the Freshman badge
  • 09:06 ulysses35 won the CPUs badge
  • 01:00 fleeb won the Freshman badge
  • 01:00 jaymoney61 won the Freshman badge
  • 07:06 amdfangirl won the Watchman badge
  • 01:00 benw won the Freshman badge
  • 01:00 anmjoven won the Freshman badge
  • 01:00 dpnaugle won the Freshman badge
  • 01:00 ayeohx won the Freshman badge
  • 03:58 sanchz won the Sophmore badge