Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.IO;
- using System.Collections.Generic;
- class MainClass
- {
- public static void Main()
- {
- FileStream fin;
- String s;
- String lofasz;
- List<String> utvonalak = new List<String>();
- try
- {
- fin = new FileStream("C:\\malamala.txt", FileMode.Open);
- }
- catch (FileNotFoundException exc)
- {
- Console.WriteLine(exc.Message + "Cannot open file.");
- return;
- }
- StreamReader fstr_in = new StreamReader(fin);
- // Read the file line-by-line.
- while ((lofasz = fstr_in.ReadLine()) != null && (s = fstr_in.ReadLine()) != null)
- {
- utvonalak.Add(s);
- }
- fstr_in.Close();
- Random random = new Random();
- long tarhely=959447040;
- String targetpath=@"D:\Lejatszora";
- String aktual, filenev, targetfile;
- FileInfo meret;
- while (tarhely>0)
- {
- aktual = utvonalak[random.Next(1, utvonalak.Count)];
- filenev=Path.GetFileName(aktual);
- targetfile=Path.Combine(targetpath,filenev);
- File.Copy(aktual,targetfile);
- meret = new FileInfo(aktual);
- tarhely=tarhely - meret.Length;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement