1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.IO; using System.Diagnostics; namespace 当日フォルダ作成 { class Program { static void Main(string[] args) { string dir_path = @"D:\Dropbox\My Cloud Work\Text\Project\" + DateTime.Now.ToString("yyyyMMdd"); if(Directory.Exists(dir_path)) { Process.Start(dir_path); } else { Console.WriteLine("フォルダが存在しません。作成しますか?"); string yn = Console.ReadLine(); if (yn == "y") { Directory.CreateDirectory(dir_path); File.Create(dir_path + "\\" + DateTime.Now.ToString("yyyyMMdd") + ".txt"); Process.Start(dir_path); } } } } } |