Advertisement
Guest User

Untitled

a guest
Oct 15th, 2019
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.48 KB | None | 0 0
  1. using System;
  2. using System.IO;
  3.  
  4. namespace study2
  5. {
  6.     class Program
  7.     {
  8.         static void Main(string[] args)
  9.         {
  10.             try
  11.             {
  12.                 string path = "/Users/siddjuraev/Desktop/new_directory";
  13.                 Directory.CreateDirectory(path);
  14.                 var directory = new DirectoryInfo(path);
  15.                 Console.WriteLine($"{directory.CreationTime}" + "" + $"{directory.Name}");
  16.                 int w;
  17.                 if (int.TryParse(Console.ReadLine(), out w) && w==1)
  18.                 {
  19.                     Directory.CreateDirectory(path + "/folder2");
  20.                     w = int.Parse(Console.ReadLine());
  21.                     if(w == 1)
  22.                     {
  23.                         string txt = path + "/folder2/new.txt";
  24.                         File.WriteAllText(txt, "Hello my name is Sid");
  25.                         string f = File.ReadAllText(txt);
  26.                         Console.WriteLine(f);
  27.                         w = int.Parse(Console.ReadLine());
  28.                         if (w == 1)
  29.                         {
  30.                             File.WriteAllText(txt, f + "\r\nMeow");
  31.                             int.TryParse(Console.ReadLine(), out w);
  32.                             if (w == 1)
  33.                                 Directory.Delete(path, true);
  34.                         }
  35.                     }
  36.  
  37.                 }
  38.             }
  39.             catch(IOException ex)
  40.             {
  41.                 Console.WriteLine("path error");
  42.             }
  43.         }
  44.     }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement