import java.io.*;
class Merger
{
public static void main(String[] args) throws IOException
{
Console con=System.console();
System.out.print("Enter destination file name : ");
String fname=con.readLine();
File f=new File(fname);
if (f.exists())
f.delete();
FileOutputStream fos=new FileOutputStream(fname);
int i=0;
File f1=null;
while (true)
{
f1=new File(""+i+f);
if (!f1.exists())
{
break;
}
FileInputStream fis=new FileInputStream(f1);
int ch;
while((ch=fis.read())!=-1)
fos.write((char)ch);
fis.close();
f1.delete();
i++;
}
}
}
class Merger
{
public static void main(String[] args) throws IOException
{
Console con=System.console();
System.out.print("Enter destination file name : ");
String fname=con.readLine();
File f=new File(fname);
if (f.exists())
f.delete();
FileOutputStream fos=new FileOutputStream(fname);
int i=0;
File f1=null;
while (true)
{
f1=new File(""+i+f);
if (!f1.exists())
{
break;
}
FileInputStream fis=new FileInputStream(f1);
int ch;
while((ch=fis.read())!=-1)
fos.write((char)ch);
fis.close();
f1.delete();
i++;
}
}
}
No comments:
Post a Comment