728x90
반응형
ExtractFileName과 ExtractFilePath를 함께 활용한 경로 분리
파일 경로를 다룰 때 전체 경로에서 파일명과 폴더 경로를
따로 분리해야 할 일이 많습니다.
델파이에서는 ExtractFileName과 ExtractFilePath 함수를
함께 사용하면 간단하게 처리할 수 있습니다.
uses
System.SysUtils;
procedure SplitFilePath;
var
FullPath, OnlyFile, OnlyPath: string;
begin
FullPath := 'C:\Projects\MyApp\Report.pdf';
OnlyFile := ExtractFileName(FullPath);
OnlyPath := ExtractFilePath(FullPath);
ShowMessage('파일명: ' + OnlyFile); // 결과: Report.pdf
ShowMessage('폴더경로: ' + OnlyPath); // 결과: C:\Projects\MyApp\
end;
ExtractFileName: 전체 경로에서 파일 이름만 추출
ExtractFilePath: 전체 경로에서 폴더 경로만 추출
파일 열기, 저장, 로그 기록 등 경로 기반 작업에 매우 유용

#델파이
#Delphi
#ExtractFileName
#ExtractFilePath
#파일경로분리
#문자열처리
#SysUtils
#경로관리
#윈도우개발
#파일명처리
728x90
반응형
'Delphi Tip > 파일' 카테고리의 다른 글
ChangeFileExt를 사용한 파일 확장자 변경하기 (0) | 2025.04.16 |
---|---|
ExtractFileExt를 사용한 파일 확장자 추출 (0) | 2025.04.15 |
ExtractFilePath와 ExtractFileName을 활용한 파일 경로 분리 (0) | 2025.04.03 |
내 실행파일 정보보기 (0) | 2024.05.23 |
파워포인터 파일 다른이름으로 저장 (0) | 2024.04.16 |
댓글