기본 콘텐츠로 건너뛰기

추천 가젯

MSSQL - File/Folder 생성 되었는지 확인 ( xp_DirTree / xp_subdirs / xp_fileexist )

[File/Folder 확인 방법] 디스크 구조 : 'D:\TEST\TEST_SUB\TEST_SUB_FILE.txt' xp_SubDirs : 하위 디렉토리가 있는지 확인 사용법 : EXEC master.dbo.xp_SubDirs (위치) 결과 : 하위 폴터가 있는경우 - 하위 폴더 명을 리턴 하위 폴터가 없는 경우 - 공백 리턴 CREATE TABLE #SubDirs (subdirectory NVARCHAR(100)) INSERT INTO #SubDirs (subdirectory) EXEC master .dbo.xp_SubDirs 'D:\TEST\' --Select * FROM #SubDirs if exists ( Select * FROM #SubDirs ) begin select 'Action !!' end drop table #SubDirs xp_DirTree : 폴더/파일 있는지 확인 사용법 : EXEC master.dbo.xp_DirTree (위치), (depth), (파일유무) 파일 유무가 0인 경우(폴터 확인의 경우), 리턴값이 2개 현재 위치의 파일 리스트 확인 - EXEC Master.dbo.xp_DirTree 'D:\TEST\',1,1 하위 2 depth 까지의 파일 리스트 확인 - EXEC Master.dbo.xp_DirTree 'D:\TEST\',2,1 하위 1 depth 까지의 폴터 리스트 확인 - EXEC Master.dbo.xp_DirTree 'D:\TEST\',1,0 하위 2 depth 까지의 폴더 리스트 확인 - EXEC Master.dbo.xp_DirTree 'D:\TEST\',2,0 결과 : 파일이 있는 경우 - 파일 리스트 리턴 하위 폴더가 있는 경우 - 하위 폴더명을 리턴

최근 글

MySQL - Got timeout reading communication packets

Azure Virtual Machines 에서 SQL Server Disk 선택