Hi david,
While specifying the path use "\\" in place of "\". It should work.
HTH,
Ritesh Sinha
david <[EMAIL PROTECTED]> on 04/20/2000 01:38:04 PM
Please respond to "A mailing list for discussion about Sun Microsystem's
Java Servlet API Technology."
<[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
cc: (bcc: Sinha Ritesh-SWD-ITIL-UB/Itilmail)
Subject: Renaming file
Hi,
I am attaching a code down where I am renaming file. it works fine if I am
not giving the path but when I include path its giving error can somebody
help me out in this
David
import java.io.*;
import java.util.*;
public class test
{
public static void main(String args[])
{
try
{
File fil=new File("hello.txt");
if( fil.exists () )
System.out.println( "Exists");
if( fil.renameTo(new File("hello1.txt")) )
System.out.println( "Succeeded");
else
System.out.println( "Failed");
}
catch(Exception e){}
}
}
|
Hi,
I am attaching a code down where I am renaming file. it works
fine if I am not giving the path but when I include path its giving error
can somebody help me out in this
David
import java.io.*;import java.util.*; public class test{ public static void main(String args[]){ try{ File fil= new File("hello.txt"); if( fil.exists () )System.out.println( "Exists"); if( fil.renameTo(new File("hello1.txt")) )System.out.println( "Succeeded"); elseSystem.out.println( "Failed");} catch(Exception e){}} } |
