Copy codeThe Code is as follows:/delete a folder, the parameter folder path
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 );
}
}
// Delete path, input parameter, and file path
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 );
}
}
// Create a folder based on parameters
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 ("createdicecloud Error dir =" + dir, e );
Throw new ServerSystemException ("createdicec1_error dir =" + dir, e );
}
}