using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.IO;
public partial class Test_CreateForder : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
string ForderURL = @"D:\WEBSITE\PHOTO_DATA\";
string ForderURLToTal = @"D:\WEBSITE\PHOTO_DATA\" + this.TextBox1.Text;
string ForderName = this.TextBox1.Text;
string ReadForder = string.Empty;;
//Response.Write("들어가기전"+ForderName+"<br>-------------------------------<Br>");
try
{
int AddForderNumber = 1;
//중복디렉토리 있다 ㅜ_ㅜ
if (!Directory.Exists(ForderURL + ForderName))
{
ReadForder = ForderName;
//Response.Write("원래이름 통과!<br>");
}
else
{
while (Directory.Exists(ForderURL + ForderName))
{
string Temp = ForderName + "(" + AddForderNumber.ToString() + ")";
AddForderNumber++;
if (!Directory.Exists(ForderURL + Temp))
{
//만약 새로만든 디렉토리 이름으로 디렉토리가 없다면~!
ReadForder = Temp;
break;
}
}
}
System.IO.Directory.CreateDirectory(ForderURL + ReadForder );
}
catch (Exception ex) {
Response.Write(ex.ToString());
}
}
}
'C#.NET IO' 카테고리의 다른 글
[System.Data.Linq.Binary / SaveFileDialog ] 파일 저장하기 (0) | 2010.08.03 |
---|---|
[Linq.Binary]초간단 openFileDialog 파일 읽기/쓰기 (0) | 2010.04.06 |
구조체와 클래스를 파일로 입력 및 출력 (0) | 2010.01.03 |
[ DriveInfo ] 하드 디스크 정보 및 사용량을 알고 싶을때 (0) | 2010.01.03 |
파일 중복체크해서 저장하기 (0) | 2009.12.15 |
[Serialize] 클래스 파일로 저장하기 및 불러오기 (0) | 2009.12.15 |
[ MSDN ] 하드 디스크 정보 및 사용량을 알고 싶을때 (0) | 2009.12.15 |
응용 프로그램의 현재 작업 디렉터리를 가져오기 (0) | 2009.04.27 |