c\#파일(클립)생 성 및 삭제

1158 단어 c#파일 생 성

/ ,
protected void DeleteDirectory(string dir,bool deleteSubDir)
{
try
{
Directory.Delete(dir, deleteSubDir);
}
catch (Exception e)
{
logger.Error("DeleteDirectory Error dir = " + dir, e);
throw new Exception("DeleteDirectory Error dir = " + dir, e);
}
}
// , ,
protected void DeleteFile(string dir)
{
try
{
File.Delete(dir);
}
catch (Exception e)
{
logger.Error("DeleteDirectory Error dir = " + dir, e);
throw new Exception("DeleteDirectory Error dir = " + dir, e);
}
}
//
protected void CreateDirectory(string dir)
{
try
{
if (Directory.Exists(dir))
{
logger.Warning("This Direcotry is exists dir = " + dir);
return;
}
Directory.CreateDirectory(dir);
}
catch (Exception e)
{
logger.Error("CreateDicectory Error dir = " + dir, e);
throw new ServerSystemException("CreateDicectory Error dir = " + dir, e);
}
}

좋은 웹페이지 즐겨찾기