Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.IO;
- namespace study2
- {
- class Program
- {
- static void Main(string[] args)
- {
- try
- {
- string path = "/Users/siddjuraev/Desktop/new_directory";
- Directory.CreateDirectory(path);
- var directory = new DirectoryInfo(path);
- Console.WriteLine($"{directory.CreationTime}" + "" + $"{directory.Name}");
- int w;
- if (int.TryParse(Console.ReadLine(), out w) && w==1)
- {
- Directory.CreateDirectory(path + "/folder2");
- w = int.Parse(Console.ReadLine());
- if(w == 1)
- {
- string txt = path + "/folder2/new.txt";
- File.WriteAllText(txt, "Hello my name is Sid");
- string f = File.ReadAllText(txt);
- Console.WriteLine(f);
- w = int.Parse(Console.ReadLine());
- if (w == 1)
- {
- File.WriteAllText(txt, f + "\r\nMeow");
- int.TryParse(Console.ReadLine(), out w);
- if (w == 1)
- Directory.Delete(path, true);
- }
- }
- }
- }
- catch(IOException ex)
- {
- Console.WriteLine("path error");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement