Q&A

  • 디렉토리 없으면 만들기?
디렉토리가 있는지 조사해서

없으면 만들려구 합니다.

어떻게 하나요



1  COMMENTS
  • Profile
    하창호 2001.10.16 01:18
    박태준 wrote:

    > 디렉토리가 있는지 조사해서

    > 없으면 만들려구 합니다.

    > 어떻게 하나요

    >



    if not DirectoryExists(ExePath + 'backup') then

    if not CreateDir(ExePath + 'backup') then

    raise Exception.Create('Cannot create ' + ExePath + 'backup');



    ExePath 는 제 프로그램이 실행되는 경로...



    다른걸로는



    function ForceDirectories(Dir: string): Boolean;



    Description



    DOS and Windows only allow directories to be created one at a time. For example, to create the C:APPSSALESLOCAL directory, the APPS and SALES directories must exist before the LOCAL directory can be created. Use ForceDirectories to create a directory and all parent directories that do not already exist.



    ForceDirectories returns True if it successfully creates all necessary directories, False if it could not create a needed directory.



    Note: Do not call ForceDirectories with an empty string. Doing so causes ForceDirectories to raise an exception.



    가 있어여