هذا الكود للعمل من خلال الدوس كاي امر عادي كود لنسخ محتويات ملف نصي في ملف نصي اخر
كود لنسخ محتويات ملف نصي في ملف نصي اخر
مغلق
import java.io.*;
public class FileCopier
{
public static void main(String[] args) throws IOException
{
if(args.length != 2)
{
System.out.println("invalied no. of args");
System.exit(0);
}
FileInputStream in=new FileInputStream(args[0]);
FileOutputStream out=new FileOutputStream(args[1]);
int cnt=0;
int ch;
do
{
ch=in.read();
out.write(ch);
cnt++;
}while(ch != -1);
System.out.println(cnt + " bytes copies ");
}
}يكتب الامـــــــــــر كالاتي
...[المكان الوجود به javac and java].../java FileCopier Memo.txt Neno.txt
علي ان يكون الملفين علي نفس الفهرس
الامر مرة اخري
c:/jbuilder8/jdk1.4/bin/java FileCopier Memo.txt Neno.txt
و لحذف ملف من الدليل المعطى
import java.io.*;
public class ReadFile
{
public static void main(String[] args) throws IOException
{
File F=new File("C:tempkhaleddata.txt");
F.delete();
}
}تحذير.
ان اعطيت دليل فقط فسوف يمسح كل الدليل باكمله
اللهم انا نسألك علما نافعا ونعوذ بك من حماقة الجهلاء
ولنسخ ملف الى اخر مع تبديل كلمة معينة شاهد الوصلة التالية
http://www.arabteam2000.com/vb/showthread....&threadid=26850
اللهم انا نسألك علما نافعا ونعوذ بك من حماقة الجهلاء
شكرا ً لكم
مشكورين
الشكر للجميع
هذا الموضوع مغلق.