すぐ忘れちゃうのでメモ
一覧
・デスクトップのパス
C#
string dsk = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
・フォルダの存在の確認と作成
C#
string path = @"C:\test1";
if (Directory.Exists(path))
{
Console.WriteLine("存在します");
}
else
{
Directory.CreateDirectory(path);
}
・ファイルの存在の確認と作成
C#
string path = @"C:\test\NewFile.txt";
if (File.Exists(path))
{
Console.WriteLine("存在します");
}
else
{
FileStream fileStream = File.Create(path);
}