first commit

This commit is contained in:
2026-08-07 12:53:18 +09:00
commit 0b0415f0f4
1523 changed files with 496649 additions and 0 deletions

307
Lib/FileLib.asp Normal file
View File

@@ -0,0 +1,307 @@
<%
'###########################################################################################
'ANSI 파일 함수
'파일 관련 함수
'###########################################################################################
Function FileChecker(filePath)
Dim oFSO
Set oFSO = Server.CreateObject("Scripting.FileSystemObject")
' Response.Write filePath &" <BR>"
if oFSO.FileExists(Server.MapPath(filePath)) then
FileChecker=true
Else
FileChecker=false
End If
set oFSO = nothing
End Function
'###########################################################################################
'파일 복사
'파일 관련 함수
'###########################################################################################
Function FileCopy(source,target)
Dim oFSO
Set oFSO = Server.CreateObject("Scripting.FileSystemObject")
if oFSO.FileExists(Server.MapPath(source)) Then
oFSO.CopyFile Server.MapPath(source),Server.MapPath(target)
FileCopy=true
Else
FileCopy=false
End If
set oFSO = nothing
End Function
'###########################################################################################
'파일 복사
'파일 관련 함수
'###########################################################################################
Function FileCopyAll(source,target)
Dim oFSO
Set oFSO = Server.CreateObject("Scripting.FileSystemObject")
oFSO.CopyFile Server.MapPath(source)&"\*.*",Server.MapPath(target)
FileCopyAll=true
set oFSO = nothing
End Function
'###########################################################################################
'파일 쓰기 함수
'###########################################################################################
function WriteFile(filePath,Str)
Dim oFSO,wFile
Set oFSO = Server.CreateObject("Scripting.FileSystemObject")
Set wFile = oFSO.CreateTextFile(filePath,true)
wFile.writeLine(Str)
wFile.Close
Set oFSO = nothing
end function
'###########################################################################################
'로그파일 쓰기 함수
'###########################################################################################
function WriteFileLog(filePath,Str,Survey_Flag)
Dim Strs
If Survey_Flag = True Then
Strs = Str
Else
Strs = LoadStream(filePath) & Str
End if
Dim oFSO,wFile
Set oFSO = Server.CreateObject("ADODB.Stream")
oFSO.CharSet = "utf-8"
oFSO.Mode = 3
oFSO.Type = 2
oFSO.Open
oFSO.WriteText(Strs),1
oFSO.SaveToFile filePath,2
oFSO.Flush
oFSO.Close
Set oFSO = Nothing
End function
'###########################################################################################
'로그파일 읽어오기
'###########################################################################################
Function LoadStream(FilePath)
Dim oFSO,wFile
Set oFSO = Server.CreateObject("ADODB.Stream")
oFSO.CharSet = "utf-8"
oFSO.Mode = 3
oFSO.Type = 2
oFSO.Open
oFSO.LoadFromFile FilePath
LoadStream = oFSO.ReadText
oFSO.Close
Set oFSO = Nothing
End Function
'###########################################################################################
'CONFIG 파일 수정.
'###########################################################################################
SUB MODIFY_CONFIG_FILE(PKEY,TITLE,PCOLOR)
Dim configPath : configPath = "/projectTemplate/include/Config.asp"
configFile = ReadUTF_File(configPath)
configFile = Replace(configFile,"[@PROJECTCODE]",PKEY)
configFile = Replace(configFile,"[@PROJECTTITLE]",TITLE)
configFile = Replace(configFile,"[@PROJECTCOLOR]",PCOLOR)
Dim targetPath : targetPath = "/project/"&PKEY&"/include/Config.asp"
WriteUTF_File targetPath, configFile
END SUB
'###########################################################################################
'LOG 폴더 생성
'###########################################################################################
SUB MAKE_LOG_FOLDER(PKEY)
DIM ROOTPATH : ROOTPATH = "/log/"&PKEY
DIM LOGPATH : LOGPATH = ROOTPATH & "/LOG"
DIM JSONPATH : JSONPATH = ROOTPATH & "/JSON"
MakeFolder Server.mappath(ROOTPATH)
MakeFolder Server.mappath(LOGPATH)
MakeFolder Server.mappath(JSONPATH)
END SUB
'###########################################################################################
'폴더 관련 함수
'###########################################################################################
Function FolderChecker(filePath)
Dim oFSO
Set oFSO = Server.CreateObject("Scripting.FileSystemObject")
if oFSO.FolderExists(filePath) then
FolderChecker=true
Else
FolderChecker=false
End If
set oFSO = nothing
End Function
'###########################################################################################
'폴더 만들기
'###########################################################################################
function MakeFolder(filePath)
Dim oFSO,wFolder
Set oFSO = Server.CreateObject("Scripting.FileSystemObject")
oFSO.CreateFolder filePath
Set oFSO = nothing
end Function
'###########################################################################################
'폴더 삭제
'###########################################################################################
function deleteFolder(filePath)
Dim oFSO,wFolder
Set oFSO = Server.CreateObject("Scripting.FileSystemObject")
oFSO.deleteFolder filePath
Set oFSO = nothing
end Function
'###########################################################################################
'폴더 카피
'###########################################################################################
function CopyFolder(targetPath,destinationPath)
Dim oFSO
Set oFSO = Server.CreateObject("Scripting.FileSystemObject")
oFSO.CopyFolder targetPath,destinationPath
Set oFSO = nothing
end Function
'###########################################################################################
'UTF-8
'파일 읽기
'###########################################################################################
Function ReadUTF_File(FileUrl)
Dim objStream
If FileChecker(fileUrl) Then
Set objStream = CreateObject("ADODB.Stream")
With objStream
.Charset = "utf-8"
.Type=2
.mode=3
.Open
.loadfromfile Server.Mappath(FileUrl)
ReadUTF_File=.readtext
.Close
End With
Set objStream = Nothing
Else
ReadUTF_File = ""
End IF
End Function
'###########################################################################################
'파일 저장
'###########################################################################################
Sub WriteUTF_File (FileUrl,ByVal Str)
'Response.Write fileUrl & "<BR>"
response.write server.MapPath(FileUrl)
Dim objStream
Set objStream=Server.CreateObject("ADODB.Stream")
With objStream
.Type=2 '1: 바이너리 2: for text type
.mode=3 '1: ReadOnly 2:WriteOnly 3:ReadWrite
.Charset="utf-8"
.Open
.WriteText str
.SaveToFile server.MapPath(FileUrl),2
.flush
.Close
End With
Set objStream=nothing
End Sub
'###########################################################################################
'파일 저장
'###########################################################################################
Sub WriteUTF_File2 (FileUrl,ByVal Str)
Dim objStream
Set objStream=Server.CreateObject("ADODB.Stream")
With objStream
.Type=1 '1: 바이너리 2: for text type
.mode=3 '1: ReadOnly 2:WriteOnly 3:ReadWrite
.Charset="utf-8"
.Open
.WriteText str
.SaveToFile server.MapPath(FileUrl),2
.flush
.Close
End With
Set objStream=nothing
End Sub
'###########################################################################################
'파일 삭제를 위한 함수
'###########################################################################################
function DeleteFile(filePath)
Dim oFSO
Set oFSO = Server.CreateObject("Scripting.FileSystemObject")
' 해당 파일이 있으면 삭제
If oFSO.FileExists(filePath) Then
oFSO.DeleteFile filePath
end if
Set oFSO = nothing
end Function
'###########################################################################################
'텍스트 파일 읽기 - 상대 경로로 읽어들여짐
'###########################################################################################
Function ReadFile(FileUrl)
Dim fsObj,fileObj
Dim readText
readText = ""
Set fsObj=Server.CreateObject("Scripting.FileSystemObject")
If FileChecker(FileUrl) Then
Set fileObj=fsObj.OpenTextFile(Server.MapPath(FileUrl), 1)
readText = fileObj.readAll
End IF
Set fileObj = Nothing
Set fsObj = Nothing
ReadFile = readText
End Function
%>